MySQL Forums
Forum List  »  Optimizer & Parser

Re: Create index for Join some table in MySQL
Posted by: Øystein Grøvlen
Date: May 30, 2018 12:50AM

Hi,

You should have indexes on all columns used in ON-conditions for INNER JOINS and on all columns of right-hand side table in ON-conditions of LEFT JOINS.

In addition you should have an index on vtiger_crmentity.deleted if the condition is selective (selects less than 20% of the rows).

In general, depending on the selected join order, it may be useful to have an index on the columns of the ORDER BY clause. However, in your case, the ORDER BY clause does not make much sense since the query will return only one row.

Øystein Grøvlen,
Senior Principal Software Engineer,
MySQL Group, Oracle,
Trondheim, Norway

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Create index for Join some table in MySQL
469
May 30, 2018 12:50AM


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.