Re: Indexing a small table increases the query cost
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
Subject
Views
Written By
Posted
1299
February 28, 2018 04:52AM
556
February 28, 2018 08:50AM
657
February 28, 2018 11:24AM
531
February 28, 2018 11:30AM
497
February 28, 2018 12:58PM
Re: Indexing a small table increases the query cost
735
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.