Pieter Bas Hofstede wrote 21.07.2025 11:25:
> Question:
> Can the Firebird-engine itself (optimizer, plan, index navigation on NULL) do
> optimizations like this automatically? So at some point I don't have to manually
> force to bypass the FK2-index in NULL situations?
Yes and no. Partial indexes[1] are designed exactly for such cases but
unfortunately, foreign keys cannot use them.
Perhaps it worth to request a feature that the index for FK was created with
"WHERE IS NOT NULL" condition by default.
1.
https://firebirdsql.org/file/documentation/chunk/en/refdocs/fblangref50/fblangref50-ddl-index.html#fblangref50-ddl-idx-partial
--
WBR, SD.