-
-
Notifications
You must be signed in to change notification settings - Fork 232
IN/ANY/ALL predicates may cause sub-optimal (late filtering) execution of joins [CORE5236] #5515
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
Comments
Commented by: Denis Pereira Raymundo (denistek) This file contain all necessary tables envolved in SQL: select DP_RECIBO.CODIGO_REC, DP_RECIBO_EVE.EVENTO_REV |
Modified by: Denis Pereira Raymundo (denistek)Attachment: problema.rar [ 12960 ] |
Commented by: @hvlad Just notes: a) the PLAN's you show are not the same Firebird 2.5.1 PLAN (DP_FERIAS INDEX (DP_FERIAS_IDX1, FK_DP_FERIAS_3)) while Firebird 3.0 PLAN (DP_FERIAS INDEX (DP_FERIAS_IDX1)) b) change last IN by EXISTS make query works fast in fb3
|
Commented by: @hvlad Also, i don't confirm your PLAN for 2.5.1 I see 2.5.1 PLAN (DP_REGISTRO_OEST INDEX (UNQ1_DP_REGISTRO_OEST)) 2.5.6 i.e. possible regression hapens in 2.5.x series PS 2.5.1 show fast result for both queries (with IN and with EXISTS) due to different join order in main query |
Modified by: @dyemanovsecurity: Developers [ 10012 ] => |
Modified by: @dyemanovassignee: Dmitry Yemanov [ dimitr ] |
Commented by: Denis Pereira Raymundo (denistek) Hi Vlad, thank you by your comments. Answering your questions: a) the PLAN's you show are not the same: select DP_RECIBO.CODIGO_REC, DP_RECIBO_EVE.EVENTO_REV I think this indicate that the problem is not on the choose of the plan. b) change last IN by EXISTS make query works fast in fb3 Plan ------ Performance info ------ The readings from the disk and the time of execution were reduced but not completly. Iteresting is that if I remove the line below, the result were improved too. and DP_RECIBO_EVE.RECORIGEM_REV = 0 And if I run only the statement that cross the tables, with all records, the time is good. So, why to bring empty is slow. select DP_RECIBO.CODIGO_REC, DP_RECIBO_EVE.EVENTO_REV Plan ------ Performance info ------ |
Modified by: @dyemanovpriority: Critical [ 2 ] => Major [ 3 ] Version: 2.5.6 [ 10721 ] Version: 4.0 Initial [ 10621 ] Version: 2.5.4 [ 10585 ] Component: Engine [ 10000 ] summary: Regression in Firebird => IN/ANY/ALL predicates may cause sub-optimal (late filtering) execution of joins Component: API / Client Library [ 10040 ] => |
Modified by: @dyemanovstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 4.0 Alpha 1 [ 10731 ] |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Resolved [ 5 ] QA Status: No test => Done successfully Test Details: Test checks EXPLAINED PLAN in expected_stdout, otherwise one may not see early filtering. |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Closed [ 6 ] |
Modified by: @pavel-zotovstatus: Closed [ 6 ] => Closed [ 6 ] Test Details: Test checks EXPLAINED PLAN in expected_stdout, otherwise one may not see early filtering. => Test checks EXPLAINED PLAN in expected_stdout, otherwise one may not see early filtering. For this reason min_version is 3.0.1, not 2.5.7. |
Submitted by: Denis Pereira Raymundo (denistek)
Attachments:
problema.rar
Votes: 2
Too slowly to retrieve records in the 2.5.5 version and 3.00.
Even if I force the same execution plan that used in version.
Firebird 2.5.1
PLAN (DP_REGISTRO_OEST INDEX (UNQ1_DP_REGISTRO_OEST))
PLAN (DP_FERIAS INDEX (DP_FERIAS_IDX1, FK_DP_FERIAS_3))
PLAN JOIN (JOIN (JOIN (JOIN (DP_REGISTRO NATURAL, DP_RECIBO INDEX (FK_DP_RECIBO_1)), DP_RECIBO_EVE INDEX (FK_DP_RECIBO_EVE_1, DP_RECIBO_EVE_IDX2)), DP_EVENTO INDEX (RDB$PRIMARY_DP_EVENTO)), DP_RECIBO_PER_ANTERIOR INDEX (FK_DP_RECIBO_PER_ANTERIOR_1))
------ Performance info ------
Prepare time = 0ms
Execute time = 16ms
Current memory = 1.382.144
Max memory = 2.246.624
Memory buffers = 75
Reads from disk to cache = 141
Writes from cache to disk = 0
Fetches from cache = 4.731
Firebird 3.0
PLAN (DP_REGISTRO_OEST INDEX (UNQ1_DP_REGISTRO_OEST))
PLAN (DP_FERIAS INDEX (DP_FERIAS_IDX1))
PLAN JOIN (JOIN (JOIN (JOIN (DP_REGISTRO NATURAL, DP_RECIBO INDEX (FK_DP_RECIBO_1)), DP_RECIBO_EVE INDEX (FK_DP_RECIBO_EVE_1, DP_RECIBO_EVE_IDX2)), DP_EVENTO INDEX (RDB$PRIMARY_DP_EVENTO)), DP_RECIBO_PER_ANTERIOR INDEX (FK_DP_RECIBO_PER_ANTERIOR_1))
------ Performance info ------
Prepare time = 16ms
Execute time = 4m 32s 844ms
Current memory = 2.960.928
Max memory = 3.030.104
Memory buffers = 90
Reads from disk to cache = 5.693.279
Writes from cache to disk = 0
Fetches from cache = 9.345.611
Commits: 118a78e ceacc98 1cdded6
====== Test Details ======
Test checks EXPLAINED PLAN in expected_stdout, otherwise one may not see early filtering. For this reason min_version is 3.0.1, not 2.5.7.
The text was updated successfully, but these errors were encountered: