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

Estimates for table greater than records in the table

    XMLWordPrintable

Details

    Description

      --source include/have_rocksdb.inc

      Dataset

      create table t1 (id1 bigint, id2 bigint, c1 bigint, c2 bigint, c3 bigint, c4 bigint, c5 bigint, c6 bigint, c7 bigint, primary key (id1, id2), index i(c1, c2))engine=rocksdb;
       
      let $i=0;
      while ($i<10000)
      {
        inc $i;
        eval insert t1(id1, id2, c1, c2, c3, c4, c5, c6, c7)
                values($i,    0, $i,  0,  0,  0,  0,  0,  0);
      }
      

      explain select c1 from t1 where c1 > 5 limit 10;
      

      id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
      1	SIMPLE	t1	range	i	i	9	NULL	13300	Using where; Using index
      

      If you look closely the optimizer predicts reading 13300 rows but the table t1 has in total 10000 rows. These estimates look incorrect.

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            varun Varun Gupta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.