Subject | VIEW optimization |
---|---|
Author | Gabor Boros |
Post date | 2016-04-07T16:34:56Z |
Hi All,
VIEW:
CREATE VIEW VIEW1 AS
SELECT RDB$RELATION_FIELDS.RDB$RELATION_NAME, RDB$FIELD_NAME FROM
RDB$RELATION_FIELDS
JOIN RDB$RELATIONS ON
RDB$RELATION_FIELDS.RDB$RELATION_NAME=RDB$RELATIONS.RDB$RELATION_NAME;
SELECT:
SELECT RDB$FIELD_NAME FROM VIEW1
PLAN:
PLAN JOIN (VIEW1 RDB$RELATION_FIELDS NATURAL, VIEW1 RDB$RELATIONS INDEX
(RDB$INDEX_0))
Plan contains the JOIN but that not needed for the selected field. Is
this an SQL standard thing or just Firebird's optimizer not smart enough?
Gabor
VIEW:
CREATE VIEW VIEW1 AS
SELECT RDB$RELATION_FIELDS.RDB$RELATION_NAME, RDB$FIELD_NAME FROM
RDB$RELATION_FIELDS
JOIN RDB$RELATIONS ON
RDB$RELATION_FIELDS.RDB$RELATION_NAME=RDB$RELATIONS.RDB$RELATION_NAME;
SELECT:
SELECT RDB$FIELD_NAME FROM VIEW1
PLAN:
PLAN JOIN (VIEW1 RDB$RELATION_FIELDS NATURAL, VIEW1 RDB$RELATIONS INDEX
(RDB$INDEX_0))
Plan contains the JOIN but that not needed for the selected field. Is
this an SQL standard thing or just Firebird's optimizer not smart enough?
Gabor