bad plan joining view including union
-------------------------------------

                 Key: CORE-4049
                 URL: http://tracker.firebirdsql.org/browse/CORE-4049
             Project: Firebird Core
          Issue Type: Improvement
          Components: Engine
    Affects Versions: 2.5.2, 2.0.7
            Reporter: Attila Molnár
            Priority: Minor


Hi!

CREATE TABLE a (id INTEGER PRIMARY KEY, code VARCHAR (10) UNIQUE, name VARCHAR 
(10));
CREATE TABLE b (id INTEGER PRIMARY KEY, code VARCHAR (10) UNIQUE, name VARCHAR 
(10));
CREATE TABLE c (id INTEGER PRIMARY KEY, code VARCHAR (10) UNIQUE, name VARCHAR 
(10));

SELECT *
FROM c
    JOIN v ON v.code = c.code
WHERE c.name = 'x'

This has the following plan now : 
PLAN JOIN ((V A NATURAL)
PLAN (V B NATURAL), C INDEX (RDB$8))

This is wrong. It shold be (same as the select with left join) : 
PLAN JOIN (C INDEX (CI1)(V A INDEX (RDB$2))
PLAN (V B INDEX (RDB$4)))

Index statistics ha no effect at all, the plan is always wrong.

Thank You!

-- 
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

       

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to