Subject | Optimizing cross-joins / aggregate-selects / no-fields from relation used - when possible ? |
---|---|
Author | Arno Brinkman |
Post date | 2002-12-07T09:54:53Z |
Hi All,
I've seen in the source that allways a record is fetched (getting page where
record is stored) when a index-retrieval is done, right ?
If we have for example this query :
SELECT
Count(*)
FROM
PROJECT p
JOIN Employee e ON (e.EMP_NO = p.TEAM_LEADER)
The PLAN :
PLAN JOIN (P NATURAL,E INDEX (RDB$PRIMARY7))
In the above query for every index RDB$PRIMARY7 found is the linked
page/record fetched.
Wouldn't it speed up increadibly when we don't fetch the linked record, but
only do an index evaluate ?
To determine if this is possible we should know if / which fields are used
for an relation is this information already available at some stage ? For
example in the RSB ?
And the same could be done for :
SELECT
p.*
FROM
PROJECT p
JOIN Employee e ON (e.EMP_NO = p.TEAM_LEADER)
Suggestions, comments ?
Regards,
Arno
I've seen in the source that allways a record is fetched (getting page where
record is stored) when a index-retrieval is done, right ?
If we have for example this query :
SELECT
Count(*)
FROM
PROJECT p
JOIN Employee e ON (e.EMP_NO = p.TEAM_LEADER)
The PLAN :
PLAN JOIN (P NATURAL,E INDEX (RDB$PRIMARY7))
In the above query for every index RDB$PRIMARY7 found is the linked
page/record fetched.
Wouldn't it speed up increadibly when we don't fetch the linked record, but
only do an index evaluate ?
To determine if this is possible we should know if / which fields are used
for an relation is this information already available at some stage ? For
example in the RSB ?
And the same could be done for :
SELECT
p.*
FROM
PROJECT p
JOIN Employee e ON (e.EMP_NO = p.TEAM_LEADER)
Suggestions, comments ?
Regards,
Arno