Skip to content
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

adding Coalesce in subquery in query like Select ID, Coalesce(Select SUM() ...) FROM SOME_TABLE do double plans and double count of reads from [CORE1722] #849

Closed
firebird-automations opened this issue Feb 1, 2008 · 5 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @livius2

Duplicates CORE501

select
(SELECT SUM(DMD.ILOSC) FROM DOC_MAG_DET DMD WHERE DMD.ID_DOC_MAG=http://DM.ID)
FROM
DOC_MAG DM

plans:
PLAN (DMD INDEX (FK_DOC_MAG_DET__ID_DOC_MAG))
PLAN (DM NATURAL)

example record reads from DMD 5000
but after adding only Coalesce

select
COALESCE((SELECT SUM(DMD.ILOSC) FROM DOC_MAG_DET DMD WHERE DMD.ID_DOC_MAG=http://DM.ID), 0)
FROM
DOC_MAG DM

plans:
PLAN (DMD INDEX (FK_DOC_MAG_DET__ID_DOC_MAG))
PLAN (DMD INDEX (FK_DOC_MAG_DET__ID_DOC_MAG))
PLAN (DM NATURAL)

record reads from DMD are now 2x5000 = 10000

this do performance degradation

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue duplicates CORE501 [ CORE501 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Duplicates CORE501.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Duplicate [ 3 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant