mysql - How to index a table for a query with "order by if"? -
is possible create index facilitate order in following query there if condition, follows?:
select a, b, c, d, e mytable order if(published, 0, 1), rank, title
i've tried creating index on mytable(published, rank, title) , index on mytable(rank, title), testing query explain shows no index employed.
"published" tinyint , either 0 or 1; "rank" tinyint, of values in range; "title" varchar(255).
many (i'm working code i've inherited developer...)
in particular example, looks query re-written as:
select a, b, c, d, e mytable order published desc, rank, title
in particular, wouldn't work arbitrary transformation functions, work in example.
Comments
Post a Comment