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

Index is not used for row_end in UPDATE/DELETE

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 10.3, 10.4
    • Fix Version/s: N/A
    • Component/s: Versioned Tables
    • Labels:
      None

      Description

      row_end is not used when searching by PRIMARY KEY

      create table t (pk int primary key) with system versioning;
      insert into t values (1), (2);
      explain extended delete from t where pk=1;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	SIMPLE	t	range	PRIMARY	PRIMARY	4	NULL	1	100.00	Using where
      explain extended update t set pk=11 where pk=1;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	SIMPLE	t	range	PRIMARY	PRIMARY	4	NULL	1	100.00	Using where; Using buffer
      

      Both queries should affect only current system rows. In both queries PK is used which consists of (pk, row_end). row_end = current_timestamp is implied and it would be useful to use second keypart for filtering. But EXPLAIN shows only 4 bytes of key is used which means pk only.

      Using row_end will not change correctness. But it can speed up some queries a bit.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              midenok Aleksey Midenkov
              Reporter:
              kevg Eugene Kosov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.