Uploaded image for project: 'Apache Trafodion (Retired)'
  1. Apache Trafodion (Retired)
  2. TRAFODION-1467

Update statistics does not generate multi-column key stats on a salted table

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.1 (pre-incubation)
    • 2.0-incubating
    • sql-cmu

    Description

      The EVERY KEY or EVERY COLUMN option in update statistics generates multi-column statistics for all the key columns. It does not do this if the table is salted, potentially leading to poor plans.

      Example of when it works:
      create table t1 (a int NOT NULL NOT DROPPABLE, b int NOT NULL NOT DROPPABLE, c int NOT NULL NOT DROPPABLE, primary key (a, b, c));

      update statistics for table t1 on every key;

      showstats for table t1 on existing columns;
      Histogram data for Table TRAFODION.BCI.T1
      Table ID: 7427073929238755441

      Hist ID # Ints Rowcount UEC Colname(s)
      ========== ====== =========== =========== ===========================
      868236218 1 0 0 C
      868236223 1 0 0 B
      868236228 1 0 0 A
      868236233 1 0 0 A, B
      868236238 1 0 0 A, B, C

      Example of when it doesn't (salted table):
      create table t1 (a int NOT NULL NOT DROPPABLE, b int NOT NULL NOT DROPPABLE, c int NOT NULL NOT DROPPABLE, primary key (a, b, c)) salt using 4 partitions on (a, b);

      update statistics for table t1 on every key;

      showstats for table t1 on existing columns;
      Histogram data for Table TRAFODION.BCI.T1
      Table ID: 7427073929238776270

      Hist ID # Ints Rowcount UEC Colname(s)
      ========== ====== =========== =========== ===========================
      998895314 1 0 0 C
      998895319 1 0 0 B
      998895324 1 0 0 A
      998895329 1 0 0 "SALT"
      998895334 1 0 0 "SALT", A, B, C

      Attachments

        Activity

          People

            dbirdsall Dave Birdsall
            RohitJain13 Rohit Jain
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: