1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-18478 ANALYZE for statement should show selectivity of ICP, part#2

Part#2, variant 2: Make the printed r_ values in JSON output consistent.
After this patch, ANALYZE output has:

- r_index_rows (NEW) - Observed number of rows before ICP or Rowid Filtering
  checks. This is a per-scan average. like r_rows and "rows" are.

- r_rows (AS BEFORE) - Observed number of rows after ICP and Rowid Filtering.

- r_icp_filtered (NEW) - Observed selectivity of ICP condition.

- (AS BEFORE) observed selectivity of Rowid Filter is in
  $.rowid_filter.r_selectivity_pct

- r_total_filtered - Observed combined selectivity: fraction of rows left
  after applying ICP condition, Rowid Filter, and attached_condition.
  This is now comparable with "filtered" and is printed right after it.

- r_filtered (AS BEFORE) - Observed selectivity of "attached_condition".

Tabular ANALYZE output is not changed. Note that JSON's r_filtered and
r_rows have the same meanings as before and have the same meaning as in
tabular output.
This commit is contained in:
Sergei Petrunia
2024-02-26 11:32:38 +03:00
parent e87d1e391b
commit 0940a96940
32 changed files with 912 additions and 449 deletions

View File

@@ -604,7 +604,7 @@ enum explain_extra_tag
class EXPLAIN_BKA_TYPE
{
public:
EXPLAIN_BKA_TYPE() : join_alg(NULL) {}
EXPLAIN_BKA_TYPE() : join_alg(NULL), is_bka(false) {}
size_t join_buffer_size;
@@ -616,6 +616,9 @@ public:
*/
const char *join_alg;
/* true <=> BKA is used */
bool is_bka;
/* Information about MRR usage. */
StringBuffer<64> mrr_type;
@@ -676,14 +679,6 @@ public:
void print_explain_json(Explain_query *query, Json_writer *writer,
bool is_analyze);
/*
TODO:
Here should be ANALYZE members:
- r_rows for the quick select
- An object that tracked the table access time
- real selectivity of the filter.
*/
};
@@ -870,7 +865,7 @@ public:
/*
This is either pushed index condition, or BKA's index condition.
(the latter refers to columns of other tables and so can only be checked by
BKA code). Examine extra_tags to tell which one it is.
BKA code). Examine extra_tags (or bka_type.is_bka) to tell which one it is.
*/
Item *pushed_index_cond;