Re: Will a composed index help me?
Posted by:
Rick James
Date: April 10, 2009 10:31AM
It depends. Without the schema and the whole SELECT, I can't tell.
If you have PRIMARY KEY(F11) (and it is InnoDB), then the PK and the data occupy the same BTree, so you can get to F12 for 'free'. That is, you won't need another index.
If you have UNIQUE(F11), well, did it turn into the PK?
If your JOIN needs to fetch other fields from T1, then the index won't help.
Also, the JOIN might start with T2. That opens up another can of worms.
Otherwise, INDEX(F11, F12) would help because then it would be "using index". See the EXPLAIN to see this.
To assist in analyzing slow SELECTs, please provide
* SHOW CREATE TABLE tbl\G
* SHOW TABLE STATUS LIKE 'tbl'\G
* EXPLAIN SELECT ...\G
and surround them with [ code ] and [ / code ]
Subject
Views
Written By
Posted
4254
April 09, 2009 12:36AM
Re: Will a composed index help me?
2312
April 10, 2009 10:31AM
Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
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.