mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-28846 Poor performance when rowid filter contains no elements
When a range rowid filter was used with an index ref access the cost of accessing the index entries for the records rejected by the filter was not taken into account. For a ref access by an index with big average number of records per key this led to poor execution plans if selectivity of the used filter was high. The patch resolves this problem. It also introduces a minor optimization that skips look-ups into a filter that turns out to be empty. With this patch the output of ANALYZE stmt reports the number of look-ups into used rowid filters. The patch also back-ports from 10.5 the code that properly sets the field TABLE::file::table for opened temporary tables. The test cases that were supposed to use rowid filters have been adjusted in order to use similar execution plans after this fix. Approved by Oleksandr Byelkin <sanja@mariadb.com>
This commit is contained in:
@ -355,11 +355,14 @@ public:
|
||||
|
||||
uint get_container_elements() { return container_elements; }
|
||||
|
||||
uint get_container_lookups() { return n_checks; }
|
||||
|
||||
double get_r_selectivity_pct()
|
||||
{
|
||||
return (double)n_positive_checks/(double)n_checks;
|
||||
return n_checks ? (double)n_positive_checks/(double)n_checks : 0;
|
||||
}
|
||||
|
||||
size_t get_container_buff_size() { return container_buff_size; }
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user