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

Performance degradation in FB 3.0.2 compared to FB 2.5.7 [CORE5421] #5694

Closed
firebird-automations opened this issue Dec 15, 2016 · 5 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Andrei Kireev (andreik)

Votes: 2

Here is the query:

SELECT FIRST(1)
http://doc.id, doc.documentdate
FROM
usr$wg_taxation card
JOIN gd_document doc ON http://doc.id = card.documentkey
WHERE
card.usr$emplkey = :emplkey
AND
doc.documentdate <= :begindate
ORDER BY
doc.documentdate DESC

Table usr$wg_taxation has 1 record, table gd_document -- 7.5 millions.

Statistics for PK of usr$wg_taxation -- 1.
Statistics for PK of GD_DOCUMENT -- 1.3158557976567E-7
Statistics for GD_X_DOCUMENT_DOCUMENTDATE index -- 0.00020177561964374.

FB 2.5.7 execution time less than 1 ms.

Query plan: SORT (JOIN (CARD INDEX (USR$FKWG_TAXATION951), DOC INDEX (RDB$PRIMARY112)))

FB 3.0.2 execution time 13 156 ms.

Query plan:

Select Expression
-> First N Records
-> Nested Loop Join (inner)
-> Filter
-> Table "GD_DOCUMENT" as "DOC" Access By ID
-> Index "GD_X_DOCUMENT_DOCUMENTDATE" Range Scan (lower bound: 1/1)
-> Filter
-> Table "USR$WG_TAXATION" as "CARD" Access By ID
-> Bitmap
-> Index "RDB$PRIMARY502" Unique Scan

Commits: 60d20db 5dca3df

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-automations
Copy link
Collaborator Author

Commented by: José R López (jrl)

It seems that this issue is the same described in CORE5310 and comments (Incorrect PLAN using in Firebird 3 making it slow): Firebird 3 is sometimes choosing the index with less selectivity.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

Fix Version: 3.0.2 [ 10785 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

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

2 participants