Details

    • Type: Task
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      This feature enable to leverage storage engine features at the SQL Layer.

      Spatial index for any storage :

       ALTER TABLE t1_innodb ADD FUNCTIONAL INTERNAL INDEX idx1(c1) UNIQUE PIVOT(primary)  SPATIAL USING MyISAM

      Clustered index for any storage:

       ALTER TABLE t1_innodb ADD FUNCTIONAL INTERNAL INDEX idx1(c1) UNIQUE PIVOT(primary) CLUSTERED=YES USING TokuDB
      • This create a new table idx1 (PK,c1).
      • This table have storage engine defined with USING keyword
      • This table have a spatial index or a clustered index on c1
      • This table is auto updated when define as INTERNAL and is not updated with keyword EXTERNAL
      • This table is a 1 to 1 relation on the primary key of the indexed table keyword UNIQUE PIVOT(primary)

      Parser rewrite query and inject subquery for QP using t1_innodb and filters on column c1

      like :

       SELECT * FROM  t1_innodb where MBR_CONTAINS(GEOM_FROMTEXT(blabal) ,c1)

      rewrite to :

       SELECT * FROM  t1_innodb  JOIN (SELECT idx1.c1  FROM  idx1 WHERE GEOM_FROMTEXT(blabal) ,c1))  fct_index1  ON  fctindex1.pk=t1_innodb.pk  WHERE MBR_CONTAINS(GEOM_FROMTEXT(blabal) ,c1)

      Performance improvements using external table materialization

       ALTER TABLE t1_innodb ADD FUNCTIONAL EXTERNAL INDEX idx1(t2.c2, t3.c3) NON UNIQUE PIVOT (fctT1.c1=t1_innodb.c1)
      • This index point to an already exiting table idx1 (c1,c2,c3).
      • This table is not updated by MariaDB but via triggers, scheduler, sphinx_se
      • This table have same columns name and value found in other tables EXTERNAL INDEX idx1(t2.c2, t3.c3)
      • This table is joinable on such columns PIVOT (idx1.c1=t1_innodb.c1)
      • This table is a 1 ton n relation defined with keyword NON UNIQUE
      • This table is having an index on c2,c3
       SELECT * FROM  t1_innodb JOIN t2 USING(id) JOIN t3 USING(id) WHERE t2.c1=4 AND t3.c2> 10

      Rewrite to

       SELECT* FROM  t1_innodb JOIN t2 USING(id) JOIN t3 USING(id) JOIN (SELECT DISTINCT t1.column  FROM  t1 WHERE WHERE t2.c1=4 AND t3.c2> 10 )   fct_index1  ON  fctindex1.c1=t1_innodb.c1 WHERE t2.c1=4 AND t3.c2> 10 

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                Unassigned
                Reporter:
                stephane@skysql.com VAROQUI Stephane
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: