Open
Description
Sometimes it is necessary to use not exists
conditions on big tables. At present, besides common b-tree indexes, Firebird does not provide any efficient way for optimizing such queries:
select l.changelog_id from changelog l
where not exists (select * from changelogdet ld on ld.changelog_id = l.changelog_id and ld.target_id = :target_id)
Most relational databases also do not provide any special optimizations for such cases, but Oracle does. There is a special type of index called "Bitmap Join Index":
CREATE BITMAP INDEX idx_changelog_not_exists
ON changelog(ld.target_id)
FROM changelog l, changelogdet ld
WHERE ld.changelog_id = l.changelog_id;
In case of low cardinality in "target_id" values this index can be efficiently used to optimize "not exists" conditions without scanning b-tree index on the "changelogdet" table which can be much bigger than "changelog" table itself.
Metadata
Metadata
Assignees
Labels
No labels