Bug #3012 Add counts to indexes
Submitted: 29 Feb 2004 8:57 Modified: 28 Nov 2005 10:23
Reporter: Cornelius Sybrandy Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:Any OS:Any (Any)
Assigned to: CPU Architecture:Any

[29 Feb 2004 8:57] Cornelius Sybrandy
Description:
I was thinking that a potentially useful enhancement to how MySQL indexes table would be to store the number of records associated with a value in the index itself.  This way, if we do counts on an indexed column, we can use the values stored in the index, which should give us a very good speedup.  The only problems I forsee is that this would make index creation and updates slower.

How to repeat:
[28 Nov 2005 10:23] Valeriy Kravchuk
Thank you for an idea, but, as you identified yourself, its implementation (at least, in btree indexes) will lead to slowdown of inserts and updates. Moreover, a separate count will give real speed increase only when using "bad" indexes for select (those with a few distinct values). So, I do not think that this feature will be implemented for btree indexes at all.