Details
-
Task
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
2.1
-
None
Description
Consider the following query:
SELECT ... FROM A a INNER JOIN B b ON b.id = a.foreign_id1 OR b.id = a.foreign_id2
In this case H2 cannot use indexes on foreign_id1 or foreign_id2 columns and query execution takes extraordinary time. Known workaround for a problem is to apply multiple JOINs, e.g.:
SELECT ... FROM A a LEFT OUTER JOIN B b1 ON b1.id = a.foreign_id1 LEFT OUTER JOIN B b2 ON b2.id = a.foreign_id2 WHERE b1.id IS NOT NULL AND b2.id IS NOT NULL
On a single real-world scenario it improved exeution time by a factor of 500 (from 4s to 80ms).
Something is terribly wrong here. Probably, H2 cannot perform necessary query re-write, or cannot understand how to use index. Let's find a way to fix that.
Attachments
Issue Links
- is duplicated by
-
IGNITE-6633 Repair basic SQL functionality
- Closed
- is related to
-
IGNITE-4150 B-Tree index cannot be used efficiently with IN clause.
- Resolved
- mentioned in
-
Page Loading...