MySQL Forums
Forum List  »  Optimizer & Parser

Slow search on one table, many where, order by and limit
Posted by: Yair P
Date: February 07, 2010 07:34AM

Hi, on a dating site we have a big cards table (500k rows) with about 20 fields.

So cards table has a,b,c,d,e... fields and we run a search like:

select * from cards where a=_ and b=_ and c=_ and d=_ and e=_ order by j limit 100

The search takes several seconds to run.

The problem is that the user selects which parameters to use.
for example we may have:
select * from cards where b=_ and e=_ order by j limit 100
or
select * from cards where a=_ and d=_ and e=_ order by j limit 100

So we cannot just create index on a,b,c,d,e,j.

It is not practical to defined 32 different key combinations (2 to the power of 5)

Any suggestions?

Thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
Slow search on one table, many where, order by and limit
4231
February 07, 2010 07:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.