MySQL: Why is simple query not using index, performing filesort -
i have table defined so:
`id` int(10) not null auto_increment, `slug` varchar(150) not null, `title` varchar(150) not null, `description` text not null, `ordinal` int(10) not null default '0'
let's call t1
in t1, have index on ordinal.
this table contains few rows, it's definitions table this, definitions in order want them
select * t1 1 order ordinal;
if perform explain on statement, following:
id? select_type? table? partitions? type? possible_keys? key? key_len? ref? rows? extra? 1 simple t1 null null null null null 5 using where; using filesort
it doesn't matter row above screwed in alignment. important part it's using filesort , can't figure out why.
since it's 5-10 rows in table, can feel it's not important filesort makes open_tables go bit bananas since mysql (according mighty internet) opens 2 tables each filesort query needs perform.
so, greatful here. thanks.
your table not have index on "ordinal" column possibly utilized. also, since clause on fixed "1" value true, no column compare or index help, can't pick anything... going through filesort... no index applicable , no index applicable order clause.
Comments
Post a Comment