mysql - Using ORDER BY while still maintaining use of index -


i'd retrieve rows utilizing index on columns , b. told way ensure index being used retrieve rows use order clause, example:

a  b  offset 1  5   1 1  4   2 2  5   3 2  4   4  select a,b tablex  offset > 0 , offset < 5  order a,b asc 

but results rows returned ordered column b , not a,b.

a  b 1  4   2  4     2  5    1  5  

how can , still ensure index being used , not full table scan? if use order b doesn't mean mysql scan b , defeat purpose of having 2 column index?

any index includes or b cloumns have no effect on query, regardless of order by. need index on offset field being used in hte where clause.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -