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

TokuDB duplicates PK columns in secondary index

    XMLWordPrintable

Details

    Description

      Given the following table:

      CREATE TABLE IF NOT EXISTS obj (
        `partition` SMALLINT UNSIGNED NOT NULL,
        oid BIGINT UNSIGNED NOT NULL,
        tid BIGINT UNSIGNED NOT NULL,
        data_id BIGINT UNSIGNED NULL,
        value_tid BIGINT UNSIGNED NULL,
        PRIMARY KEY (`partition`, oid, tid),
        KEY tid (`partition`, tid, oid),
        KEY (data_id)
      ) ENGINE=TokuDB;
      

      tokuftdump shows that the 'tid' index duplicates all columns of the primary key whereas they're already in the secondary key. IOW, TokuDB stores:

      <partition><tid><oid><partition><oid><tid> => ''
      

      instead of only (like InnoDB):

      <partition><tid><oid> => ''
      

      This is quite space inefficient with all the obvious consequences (less efficient caches, more time to compress).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jmuchemb Julien Muchembled
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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