-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UNION ALL optimalization with fix false condition #8113
Comments
It will need to get that row to be able to evaluate that it should be filtered out. |
EPluribusUnum
changed the title
UNION all optimalization with fix false condition
UNION ALL optimalization with fix false condition
May 14, 2024
The filtered column is a constant, so the column value is known at prepare time. The condition on the constant column also constant, so the condition can be evaluated at prepare time without needing to fetch any record from the table at exec time. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi *!
CREATE OR ALTER VIEW union_opt
AS
SELECT 'A' union_id
FROM rdb$database
UNION ALL
SELECT 'B'
FROM rdb$database
SELECT *
FROM union_opt
WHERE union_id = 'A'
The select does 2 non-index reads.
I think it should be only 1 non-index read, as the second select expressions conditon is fix false, no row-by-row evaluation is needed.
Thank you!
The text was updated successfully, but these errors were encountered: