Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7854

ANALYZE FORMAT=JSON should provide info about used tmp.tables

Details

    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.

      Attachments

        Issue Links

          Activity

            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?)

            psergei Sergei Petrunia added a comment - 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?)

            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.

            psergei Sergei Petrunia added a comment - 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.

            People

              psergei Sergei Petrunia
              psergei Sergei Petrunia
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.