Derby
  1. Derby
  2. DERBY-649 Useful indexes not used in UNION ALL
  3. DERBY-772

Handle pushing IN predicates into UNIONs. This would allow use of index if present improving performance.

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.2.0, 10.1.2.1, 10.2.1.6
    • Fix Version/s: 10.1.3.1, 10.2.1.6
    • Component/s: SQL
    • Labels:
      None
    • Environment:
      generic

      Description

      While fix for DERBY-649 allows pushing binary predicates into SELECT statements that are underneath a UNOIN, it would also be good to allow IN operations to be pushed. Derby can rewrite IN operations in a way to allow use of index, if present.

      Derby currently rewrites: REF IN (1, 2, 3) to REF >=1 and REF <=3 and hence would allow use of index on REF, if present. Pushing this predicate into Union would allow use of index on REF for queries like:

      Select * from
      (SELECT REF, NAME from T1 UNION ALL SELECT REF, NAME from t2)
      where REF IN (1,2,3)

      1. DERBY-772.patch
        22 kB
        Satheesh Bandaram

        Activity

        Satheesh Bandaram created issue -
        Satheesh Bandaram made changes -
        Field Original Value New Value
        Attachment DERBY-772.patch [ 12321395 ]
        Satheesh Bandaram made changes -
        Attachment DERBY-772.patch [ 12321395 ]
        Hide
        Satheesh Bandaram added a comment -

        Add couple more tests.

        Show
        Satheesh Bandaram added a comment - Add couple more tests.
        Satheesh Bandaram made changes -
        Attachment DERBY-772.patch [ 12321396 ]
        Hide
        Daniel John Debrunner added a comment -

        -1 due to regression, see comments in DERBY-649

        Show
        Daniel John Debrunner added a comment - -1 due to regression, see comments in DERBY-649
        Hide
        Satheesh Bandaram added a comment -

        Ported this fix to 10.2, now that Dan's failing test case has been fixed for DERBY-649.

        Sending java\engine\org\apache\derby\impl\sql\compile\PredicateList.java
        Sending java\engine\org\apache\derby\impl\sql\compile\SelectNode.java
        Sending java\engine\org\apache\derby\impl\sql\compile\UnionNode.java
        Sending java\testing\org\apache\derbyTesting\functionTests\master\predicatesIntoViews.out
        Sending java\testing\org\apache\derbyTesting\functionTests\tests\lang\predicatesIntoViews.sql
        Transmitting file data .....
        Committed revision 370254.

        Show
        Satheesh Bandaram added a comment - Ported this fix to 10.2, now that Dan's failing test case has been fixed for DERBY-649 . Sending java\engine\org\apache\derby\impl\sql\compile\PredicateList.java Sending java\engine\org\apache\derby\impl\sql\compile\SelectNode.java Sending java\engine\org\apache\derby\impl\sql\compile\UnionNode.java Sending java\testing\org\apache\derbyTesting\functionTests\master\predicatesIntoViews.out Sending java\testing\org\apache\derbyTesting\functionTests\tests\lang\predicatesIntoViews.sql Transmitting file data ..... Committed revision 370254.
        Hide
        Satheesh Bandaram added a comment -

        Fix in both 10.1 and trunk.

        Show
        Satheesh Bandaram added a comment - Fix in both 10.1 and trunk.
        Satheesh Bandaram made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 10.1.3.0 [ 12310616 ]
        Resolution Fixed [ 1 ]
        Hide
        Satheesh Bandaram added a comment -

        Verified customer problem is fixed in 10.2. Fix already present in 10.1 branch.

        Show
        Satheesh Bandaram added a comment - Verified customer problem is fixed in 10.2. Fix already present in 10.1 branch.
        Satheesh Bandaram made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Andrew McIntyre added a comment -

        Reopening to set Fix In to 10.1.3 also.

        Show
        Andrew McIntyre added a comment - Reopening to set Fix In to 10.1.3 also.
        Andrew McIntyre made changes -
        Status Closed [ 6 ] Reopened [ 4 ]
        Resolution Fixed [ 1 ]
        Andrew McIntyre made changes -
        Resolution Fixed [ 1 ]
        Status Reopened [ 4 ] Closed [ 6 ]
        Gavin made changes -
        Workflow jira [ 12344931 ] Default workflow, editable Closed status [ 12797750 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        31d 22h 47m 1 Satheesh Bandaram 19/Jan/06 05:49
        Resolved Resolved Closed Closed
        51m 38s 1 Satheesh Bandaram 19/Jan/06 06:40
        Closed Closed Reopened Reopened
        95d 20h 54m 1 Andrew McIntyre 25/Apr/06 04:35
        Reopened Reopened Closed Closed
        5m 42s 1 Andrew McIntyre 25/Apr/06 04:41

          People

          • Assignee:
            Unassigned
            Reporter:
            Satheesh Bandaram
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development