MySQL Forums
Forum List  »  Optimizer & Parser

How should I index the tables in this query?
Posted by: Dan Bress
Date: February 09, 2007 01:35PM

SELECT DISTINCT(table_a.value) FROM table_a, table_b WHERE table_a.state = 1 AND table_a.value=table_b.key LIMIT 1000;

what would the proper way to index each of the following tables be?

We already have a unique index on table_b.key

should I index table_a.value and table_a.state in one index, since they are both used? or table_a.state in an index, and table_a.value in an index?

Thanks, Dan

Edited 1 time(s). Last edit at 02/09/2007 01:36PM by Dan Bress.

Options: ReplyQuote

Written By
How should I index the tables in this query?
February 09, 2007 01:35PM

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.