Bad optimization of quiries with OR predicate to view with union
----------------------------------------------------------------

                 Key: CORE-4102
                 URL: http://tracker.firebirdsql.org/browse/CORE-4102
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 2.5.2, 2.1.5
            Reporter: GR


Script to reproduce:

CREATE TABLE TEST_TABLE (ID  INTEGER);
CREATE INDEX IDX1 ON TEST_TABLE (ID);

CREATE VIEW TEST_VIEW
AS
SELECT ID FROM TEST_TABLE
UNION ALL
SELECT ID FROM TEST_TABLE ;

===============================================

Queries with plans:

SELECT *
FROM TEST_TABLE
WHERE (ID = 0) OR (ID = 1)

Plan
PLAN (TEST_TABLE INDEX (IDX1, IDX1))

----------------------------------------

SELECT * FROM TEST_VIEW
WHERE (ID = 0)

Plan
PLAN (TEST_VIEW TEST_TABLE INDEX (IDX1))
PLAN (TEST_VIEW TEST_TABLE INDEX (IDX1))

----------------------------------------

SELECT * FROM TEST_VIEW
WHERE (ID = 0) OR (ID = 1)

Plan
PLAN (TEST_VIEW TEST_TABLE NATURAL)
PLAN (TEST_VIEW TEST_TABLE NATURAL)

while expected 

Plan
PLAN (TEST_VIEW TEST_TABLE INDEX (IDX1, IDX1))
PLAN (TEST_VIEW TEST_TABLE INDEX (IDX1, IDX1))


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to