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

Estimation for filtered rows less precise with JSON histogram comparing to DOUBLE_PREC (#7) upon TIME comparison

    XMLWordPrintable

Details

    Description

      Upon request, I intentionally make tables bigger than they need to be for reproducing the problem, so that both the number of rows and the number of unique values exceed the histogram size.

      --source include/have_sequence.inc
       
      CREATE TABLE t1 (f TIME) ENGINE=MyISAM;
      INSERT INTO t1 SELECT IF(seq%2,'00:00:00',SEC_TO_TIME(seq+7200)) FROM seq_1_to_1000;
       
      SET histogram_type= JSON_HB;
      ANALYZE TABLE t1 PERSISTENT FOR ALL;
      ANALYZE FORMAT=JSON SELECT * FROM t1 WHERE f > '00:01:00';
       
      SET histogram_type= DOUBLE_PREC_HB;
      ANALYZE TABLE t1 PERSISTENT FOR ALL;
      ANALYZE FORMAT=JSON SELECT * FROM t1 WHERE f > '00:01:00';
       
      DROP TABLE t1;
      

      JSON_HB:

      preview-10.8-MDEV-26519-json-histograms da3231a8

              "table": {
                "table_name": "t1",
                "access_type": "ALL",
                "r_loops": 1,
                "rows": 1000,
                "r_rows": 1000,
                "r_table_time_ms": 0.037146099,
                "r_other_time_ms": 0.077310006,
                "filtered": 99.75002289,
                "r_filtered": 50,
                "attached_condition": "t1.f > '00:01:00'"
              }
      

      DOUBLE_PREC_HB:

              "table": {
                "table_name": "t1",
                "access_type": "ALL",
                "r_loops": 1,
                "rows": 1000,
                "r_rows": 1000,
                "r_table_time_ms": 0.033997955,
                "r_other_time_ms": 0.07762081,
                "filtered": 50,
                "r_filtered": 50,
                "attached_condition": "t1.f > '00:01:00'"
              }
      

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.