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

ORDER BY clause on compound index may disable usage of other indices [CORE5795] #6058

Closed
firebird-automations opened this issue Apr 17, 2018 · 8 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @livius2

Relate to CORE5965
Is duplicated by CORE5845

Attachments:
TESTPLAN.7z

This is releated to old CORE5020 but now i have reproductible test case with sample database

restore attached database backup
run the query

SELECT
W.DYR_ID
, W.INSP_ID
, W.KONTO_ID
, W.WPLATA_DATA_WYCIAGU
, W.WPLATA_KONTRAHENT_ID
FROM
WPLATA W
WHERE
W.WPLATA_KONTRAHENT_ID IN (136804)
AND W.DYR_ID = 9
ORDER BY
W.DYR_ID
, W.INSP_ID
, W.KONTO_ID
, W.WPLATA_DATA_WYCIAGU
, W.WPLATA_NR_WYCIAGU
, W.WPLATA_NR_POZYCJI

-------------------------------------------------
PLAN (W ORDER WPLATA_PK)

Executing statement...
Statement executed (elapsed time: 0.000s).
679228 fetches, 0 marks, 0 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 334971 index, 0 seq.
Delta memory: 248896 bytes.
Total execution time: 0.500s
Script execution finished.

------------------------------------------------
plan should be
PLAN (W INDEX (IXA_WPLATA__KONTRAHENT__PK))

Executing statement...
Statement executed (elapsed time: 0.000s).
19 fetches, 0 marks, 0 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 6 index, 0 seq.
Delta memory: 58112 bytes.
Total execution time: 0.063s
Script execution finished.

or
-----------------------------------------------
PLAN (W ORDER WPLATA_PK INDEX (IXA_WPLATA__KONTRAHENT__PK))

Executing statement...
Statement executed (elapsed time: 0.000s).
185 fetches, 0 marks, 0 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 9 index, 0 seq.
Delta memory: 59264 bytes.
Total execution time: 0.047s
Script execution finished.

Commits: 077a2a3 3103f72

@firebird-automations
Copy link
Collaborator Author

Modified by: @livius2

Attachment: TESTPLAN.7z [ 13237 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @livius2

environment: WI-V3.0.4.32951 Firebird 3.0

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue relate to CORE5965 [ CORE5965 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

Fix Version: 3.0.5 [ 10885 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Covered by another test(s)

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue is duplicated by CORE5845 [ CORE5845 ]

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