Per the profiling, our “union all” queries seem to spend lot of time in “statistics”.
Copy/pasted that line.
| Status | Duration | Source_function | Source_file | Source_line |
| statistics | 0.000476 | optimize | sql_optimizer.cc | 530
The selects inside union all don’t have any joins, aggregations or subqueries.
The tables have only primary index. No secondary indexes. The PK has 4 columns. All selects have equality predicate on at least 1 column of PK.
Any idea why “union all” spending lot of time in “statistics”? Any config to reduce time spent in it.