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

Salted queries with range scan become full table scans

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2.0, 3.2.0
    • Component/s: None
    • Labels:
      None

      Description

      See InListIT#testLeadingPKWithTrailingRVCSlotHole as an example query that will fail when given the /*+ RANGE_SCAN */ hint.

      The issue is caused by the WhereOptimizer extracting the leading partially qualified row keys of the where clause but improperly producing splitScan start and stop rows in parallel iterators.

      For example, with a where clause like:

      SELECT * FROM TABLE_SALTED_4 WHERE pk1 = 2 and pk3 = 4;
      

      The ScanRanges will set the scan boundaries as:

      [\x00\x80\x00\x00\x02 - \x03\x80\x00\x00\x03]
      

      This is technically correct as the scan start/stop rows need to include the salt byte, but it means that naively intersecting the scan ranges with region boundaries such as:

      [* - \x01]
      [\x01 - \x02]
      [\x02 - \x03]
      [\x03 - *]
      

      Will produce the following partially incorrect splitScan boundaries:

      [\x00\x80\x00\x00\x02  - \x01]
      [\x01 - \x02]
      [\x02 - \x03]
      [\x03 - \x03\x80\x00\x00\x03]
      

      Note that this is only a problem when the /*+ RANGE_SCAN */ hint is given. Without a hint, this query will use a skip scan, sidestepping the issue.

      This is also related to PHOENIX-1163 and depending on how PHOENIX-1163 is resolved, could be fixed at the same time.

        Attachments

        1. PHOENIX-1251.patch
          31 kB
          James R. Taylor
        2. PHOENIX-1251_v2.patch
          49 kB
          James R. Taylor
        3. PHOENIX-1251_v3.patch
          49 kB
          James R. Taylor
        4. PHOENIX-1251_v4.patch
          51 kB
          James R. Taylor
        5. PHOENIX-1251_v5.patch
          54 kB
          James R. Taylor
        6. PHOENIX-1251_v6.patch
          163 kB
          James R. Taylor
        7. PHOENIX-1251_v7.patch
          254 kB
          James R. Taylor
        8. PHOENIX-1251_v8a.patch
          241 kB
          James R. Taylor
        9. PHOENIX-1251_v8b.patch
          241 kB
          James R. Taylor
        10. PHOENIX-1251_v9.patch
          241 kB
          James R. Taylor

          Activity

            People

            • Assignee:
              jamestaylor James R. Taylor
              Reporter:
              kbuzsaki Kyle Buzsaki
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: