WL#1290: Better cardinality estimations for MERGE
Affects: Server-7.1 — Status: On-Hold — Priority: Medium
For now MERGE table calculates it's cardinality (or, rather, it's not cardinality per se, but a "average number of rows per unique key value", which I'd call R) as a average of R's of individual MyISAM tables. It can produce highly inaccurate results. Assuming there's a 6-row MyISAM table with R=2 and column values 1,1,2,2,3,3 and another MyISAM table with R=2 and values 4,4,5,5,6,6 - then MERGE table will have R=2, indeed. But if the second table will contain 1,1,2,2,3,3 (with R=2, of course), MERGE table will have R=4. One of the ways to fix it is to calculate min/max values for each key and range intersections between different MyISAM tables. R can be estimated assuming that values are uniformly distributed in each range (R or MyISAM tables is only meaningful in this assumption anyway).
Copyright (c) 2000, 2018, Oracle Corporation and/or its affiliates. All rights reserved.