MDEV-29284 ANALYZE doesn't work with pushed derived tables
There was no actual execution of the SQL of a pushed derived table, which caused "r_rows" to be always displayed as 0 and "r_total_time_ms" to show inaccurate numbers. This commit makes a derived table SQL to be executed by the storage engine, so the server is able to calculate the number of rows returned and measure the execution time more accurately
This commit is contained in:
parent
1bfd3cc457
commit
94a8921e9d
@ -190,7 +190,7 @@ FROM federated.t3, (SELECT * FROM federated.t1 WHERE id > 3) t
|
||||
WHERE federated.t3.name=t.name;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 7 7.00 100.00 100.00
|
||||
1 PRIMARY <derived2> ref key0 key0 18 federated.t3.name 2 0.00 100.00 100.00
|
||||
1 PRIMARY <derived2> ref key0 key0 18 federated.t3.name 2 1.00 100.00 100.00
|
||||
2 PUSHED DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
SELECT *
|
||||
FROM federated.t3, (SELECT t1.name FROM federated.t1
|
||||
@ -241,7 +241,7 @@ ANALYZE
|
||||
"ref": ["federated.t3.name"],
|
||||
"r_loops": 7,
|
||||
"rows": 2,
|
||||
"r_rows": 0,
|
||||
"r_rows": 0.1429,
|
||||
"r_total_time_ms": "REPLACED",
|
||||
"filtered": 100,
|
||||
"r_filtered": 100,
|
||||
|
@ -40,7 +40,6 @@
|
||||
Pushdown_derived::Pushdown_derived(TABLE_LIST *tbl, derived_handler *h)
|
||||
: derived(tbl), handler(h)
|
||||
{
|
||||
is_analyze= handler->thd->lex->analyze_stmt;
|
||||
}
|
||||
|
||||
|
||||
@ -57,12 +56,6 @@ int Pushdown_derived::execute()
|
||||
if ((err= handler->init_scan()))
|
||||
goto error;
|
||||
|
||||
if (is_analyze)
|
||||
{
|
||||
handler->end_scan();
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
while (!(err= handler->next_row()))
|
||||
{
|
||||
if (unlikely(thd->check_killed()))
|
||||
|
@ -2545,8 +2545,6 @@ class derived_handler;
|
||||
|
||||
class Pushdown_derived: public Sql_alloc
|
||||
{
|
||||
private:
|
||||
bool is_analyze;
|
||||
public:
|
||||
TABLE_LIST *derived;
|
||||
derived_handler *handler;
|
||||
|
Loading…
x
Reference in New Issue
Block a user