Using an index for a ranged where
im storing down ra开发者_如何学JAVAnks in one of my app, and i frequently do this:
select count(*) from table where score > ?
and ? = the current person's score. i intend to memcache this, and i use an index on this table, is there a good way to index it?
I would create the index on score
Have a look at CREATE INDEX Syntax
It is recomended though to profile a couple of options, and also take into account that this filed might be regularly updated.
yep, index with "score" as left-most part will be used with this query
精彩评论