-
Sergey Vojtovich authored
Every subsequent query to a merge table with indexes was lowering down cardinality. The problem was that key statistics was not cleared when merge children were detached. Causing next attach children perform incremental key statistics calculation. Fixed by clearing key statistics when attaching first child. mysql-test/r/merge.result: A test case for BUG#39185. mysql-test/t/merge.test: A test case for BUG#39185. storage/myisammrg/myrg_open.c: Clear key statistics when we're attaching first child, even if it's buffer was allocated before. This is needed because detach_children() doesn't clear statistics, causing incremental statistics calculation.
071cfc03