MySQL Forums
Forum List  »  Optimizer & Parser

Re: Indexing a small table increases the query cost
Posted by: Øystein Grøvlen
Date: March 01, 2018 03:15AM

When an index is available, the optimizer will have more accurate statistics about the data distribution of the column. I guess that in this case, when there is an index on active, the optimizer realizes that most rows will have active!=0. Hence, the estimated number of rows to read will be larger than when such information is not available.

In MySQL 8.0 information about data distribution can be made available to the optimizer by creating a histogram for the column. Histograms will have much less overhead than an index that needs to be maintained on every update of the column.

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

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Indexing a small table increases the query cost
639
March 01, 2018 03:15AM


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.