mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-30806: ANALYZE FORMAT=JSON: better support for BNL and BNL-H joins
In block-nl-join, add: - r_loops - this shows how many incoming record combinations this query plan node had. - r_effective_rows - this shows the average number of matching rows that this table had for each incoming record combination. This is comparable with r_rows in non-blocked access methods. For BNL-joins, it is always equal to $.table.r_rows * $.table.r_filtered For BNL-H joins the value cannot be computed from other values Reviewed by: Monty <monty@mariadb.org>
This commit is contained in:
@@ -158,6 +158,25 @@ public:
|
||||
if (unlikely((tracker)->timed)) \
|
||||
{ (tracker)->stop_tracking(thd); }
|
||||
|
||||
|
||||
/*
|
||||
Just a counter to increment one value. Wrapped in a class to be uniform
|
||||
with other counters used by ANALYZE.
|
||||
*/
|
||||
|
||||
class Counter_tracker
|
||||
{
|
||||
public:
|
||||
Counter_tracker() : r_scans(0) {}
|
||||
ha_rows r_scans;
|
||||
|
||||
inline void on_scan_init() { r_scans++; }
|
||||
|
||||
bool has_scans() const { return (r_scans != 0); }
|
||||
ha_rows get_loops() const { return r_scans; }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
A class for collecting read statistics.
|
||||
|
||||
@@ -168,20 +187,16 @@ public:
|
||||
It can be used to track reading from files, buffers, etc).
|
||||
*/
|
||||
|
||||
class Table_access_tracker
|
||||
class Table_access_tracker
|
||||
{
|
||||
public:
|
||||
Table_access_tracker() :
|
||||
r_scans(0), r_rows(0), /*r_rows_after_table_cond(0),*/
|
||||
r_rows_after_where(0)
|
||||
Table_access_tracker() : r_scans(0), r_rows(0), r_rows_after_where(0)
|
||||
{}
|
||||
|
||||
ha_rows r_scans; /* How many scans were ran on this join_tab */
|
||||
ha_rows r_scans; /* how many scans were ran on this join_tab */
|
||||
ha_rows r_rows; /* How many rows we've got after that */
|
||||
ha_rows r_rows_after_where; /* Rows after applying attached part of WHERE */
|
||||
|
||||
bool has_scans() const { return (r_scans != 0); }
|
||||
ha_rows get_loops() const { return r_scans; }
|
||||
double get_avg_rows() const
|
||||
{
|
||||
return r_scans
|
||||
@@ -200,6 +215,9 @@ public:
|
||||
inline void on_scan_init() { r_scans++; }
|
||||
inline void on_record_read() { r_rows++; }
|
||||
inline void on_record_after_where() { r_rows_after_where++; }
|
||||
|
||||
bool has_scans() const { return (r_scans != 0); }
|
||||
ha_rows get_loops() const { return r_scans; }
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user