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

Memory tables: VARCHAR and BLOB support




      Extend HEAP tables to be able to handle VARCHAR and BLOB's efficently.

      Currently HEAP stores VARCHAR at their maximum width and can't store BLOB/TEXT columns.

      This causes a problem for internally memory tables that are used to store temporary results from SELECT and also
      any query involving information_schema. This uses a lot more memory than necessary and when BLOB/TEXT are involved
      MariaDB has to create an on-disk Aria table instead of a HEAP table.

      The idea is to create a separate BLOB storage area (can consist of multipe blocks), attached to the HEAP table, that holds all long varchar and blob columns.
      table->record will hold the fixed length fields, with all VARCHAR and BLOB columns replaced with a pointer and length to the
      BLOB storage area.

      The BLOB storage will be a fixed size buffer where all VARCHAR and BLOB's are stored. Initially all VARCHAR and BLOBS are
      stored after each other. In case of UPDATE (very seldom happening for temporary tables) that extends the length of the BLOB/VARCHAR column, the new part will be linked to the original part. One BLOB/VARCHAR can be in any number of segments.

      The benefit of this structure is that there is no need for any garbage collection. There is a loss of 12 bytes per link, which is neglectable for the typical usage of temporary tables (which will not have any linked records).


        Issue Links



              monty Michael Widenius
              ratzpo Rasmus Johansson (Inactive)
              17 Vote for this issue
              14 Start watching this issue



                Git Integration

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