im storing down ranks 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?
im storing down ranks 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