[MDEV-7854] ANALYZE FORMAT=JSON should provide info about used tmp.tables Created: 2015-03-27  Updated: 2017-07-16

Status: Open
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.1
Fix Version/s: 10.2

Type: Bug Priority: Major
Reporter: Sergei Petrunia Assignee: Sergei Petrunia
Resolution: Unresolved Votes: 0
Labels: analyze-stmt

Issue Links:
Relates
relates to MDEV-6995 EXPLAIN JSON and ORDER BY, GROUP BY, etc Open
relates to MDEV-7648 Extra data in ANALYZE FORMAT=JSON $stmt Open
relates to MDEV-13330 ANALYZE FORMAT=JSON should print time... Open

 Description   

ANALYZE FORMAT=JSON should make it apparent

  • which parts of query plan were using temp tables,
  • what storage engine was used for each,
  • how many writes (and #rows if not the same) were made on the temp.table.


 Comments   
Comment by Sergei Petrunia [ 2017-07-16 ]

There are a number of query plan constructs that are using temoprary (work) tables:

  • "temporary_table" (GROUP-BY temp. table)
  • "materialized" (derived table)
  • "materialized" (non-merged semi-join materialization)
  • "materialized" (merged semi-join materialization)
  • "duplicates_removal" - temporary table used by Duplicate Weedout.
  • subqueries: [ query_block: { ... }

    ] - subquery materialization

  • ??? - subquery cache

It would be nice to be able to track all of these in a uniform way.
(Is TMP_TABLE_PARAM a good place to put the pointer to tracker helper object in?)

Comment by Sergei Petrunia [ 2017-07-16 ]

Overview of how this can be achieved:

Create a Work_table_tracker class.

  • A Work_table_tracker object will store information about how the temp. table was used.
    = its storage engine
    = its #rows
    = its size-on-storage-media
  • It will have setter-like methods for reporting information about the temp table.
  • (TODO: how does this work with parts of the query plan that are re-executed multiple times?)

Some data structure will keep a pointer to Work_table_tracker so that free_tmp_table() can call the reporting methods.

"Explain data structures" also need pointers to Work_table_tracker objects so that they can print them in the ANALYZE FORMAT=JSON output.

Generated at Thu Feb 08 07:22:46 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.