Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-2274

Sort-merge join could not optimize out the sort on the right table

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.5.2
    • 4.6.0
    • None
    • None

    Description

      CREATE TABLE t (
          mypk VARCHAR(100) NOT NULL PRIMARY KEY,
          mycol VARCHAR(200));
      
      SELECT * FROM t t1 JOIN t t2 ON t1.mypk = t2.mypk;
      

      would produce a plan like:

      SORT-MERGE-JOIN (INNER) TABLES
          CLIENT PARALLEL 1-WAY FULL SCAN OVER T
      AND
          CLIENT PARALLEL 1-WAY FULL SCAN OVER T
              SERVER SORTED BY [MYPK]
          CLIENT MERGE SORT
      

      , while it should have generated a plan like:

      SORT-MERGE-JOIN (INNER) TABLES
          CLIENT PARALLEL 1-WAY FULL SCAN OVER T
      AND
          CLIENT PARALLEL 1-WAY FULL SCAN OVER T
      

      Attachments

        1. PHOENIX-2274.patch
          12 kB
          Wei Xue

        Activity

          People

            maryannxue Wei Xue
            maryannxue Wei Xue
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: