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

Optimizer support for functional indexes does not work for delete

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 12.1
    • 12.1.1
    • Optimizer
    • None
    • Related to performance
    • part of MDEV-36132
    • Q3/2025 Maintenance

    Description

      In case:

      --source include/have_sequence.inc
       
      create table t (c int, key (c));
      insert into t select seq from seq_1_to_10000;
      alter table t
        add column vc int as (c + 1),
        add index(vc);
       
      explain select * from t order by c + 1 limit 2;
      explain delete from t order by c + 1 limit 2;
       
      drop table t;
      

      new changes from MDEV-36132 work for SELECT:

      explain select * from t order by c + 1 limit 2;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
      1	SIMPLE	t	index	NULL	vc	5	NULL	2	
      

      but do not work for DELETE:

      explain delete from t order by c + 1 limit 2;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
      1	SIMPLE	t	ALL	NULL	NULL	NULL	NULL	10000	Using filesort
      

      Attachments

        Issue Links

          Activity

            People

              ycp Yuchen Pei
              lstartseva Lena Startseva
              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.