Uploaded image for project: 'Apache AsterixDB'
  1. Apache AsterixDB
  2. ASTERIXDB-2924

Ternary joins with same probe using INLJ

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.9.7
    • IDX - Indexes
    • None

    Description

      Given the DDLs:

      DROP DATAVERSE    TestDataverse IF EXISTS;
      CREATE DATAVERSE  TestDataverse;
      USE               TestDataverse;
      
      CREATE TYPE       GenericType AS { _id: bigint, c : bigint };
      CREATE DATASET    IndexDatasetA (GenericType)
      PRIMARY KEY       _id;
      CREATE DATASET    IndexDatasetB (GenericType)
      PRIMARY KEY       _id;
      CREATE DATASET    ProbeDataset (GenericType)
      PRIMARY KEY       _id;
      
      CREATE INDEX      indexA
      ON                IndexDatasetA (k : int);
      CREATE INDEX      indexB
      ON                IndexDatasetB (k : int);

      The following ternary join query produces an INLJ plan for both indexed datasets. The join field from the probe is the probe dataset's primary key.

      --                Query 1, ternary join w/ primary key on probe.
      FROM              ProbeDataset P,
                        IndexDatasetA A,
                        IndexDatasetB B
      WHERE             P._id /* +indexnl */ = A.k AND
                        P._id /* +indexnl */ = B.k
      SELECT            COUNT(*);

      The following ternary join query produces an INLJ plan for only the left-most indexed dataset. The join field from the probe is a closed field from the probe dataset.

      --                Query 2, ternary join w/ closed field on probe.
      FROM              ProbeDataset P,
                        IndexDatasetA A,
                        IndexDatasetB B
      WHERE             P.c /* +indexnl */ = A.k AND
                        P.c /* +indexnl */ = B.k
      SELECT            COUNT(*);
      

      Both queries should produce two INLJs.

      Attachments

        Activity

          People

            ggalvizo Glenn Justo Galvizo
            ggalvizo Glenn Justo Galvizo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: