Open
Description
Problem was reported by one of our customer privately.
Consider script from attached .zip
ddl-and-run_-_for-empty-tables.sql.zip
Query that caused problems in customer environment has following plans:
- for FB 3.x and 4.x:
Select Expression
-> Aggregate
-> Filter
-> Nested Loop Join (outer)
-> Nested Loop Join (outer)
-> Filter
-> Table "PAYMENTSDETAILS" as "PD" Access By ID
-> Bitmap
-> Index "AAA_PD_PERIODFROMDATE" Range Scan (lower bound: 1/1)
-> Filter
-> Table "PAYMENTSH" as "PH" Access By ID
-> Bitmap
-> Index "PK_PAYMENTSH_MOMENT_GENEMPID" Unique Scan
-> Filter
-> Table "INVOICEH" as "IH" Access By ID
-> Bitmap Or
-> Bitmap
-> Index "PK_INVOICEH_INVID" Unique Scan
-> Bitmap
-> Index "INVOICEHBYPARENTINVOICEIDDESC" Range Scan (full match)
- for FB 5.x and 6.x:
Select Expression
-> Aggregate
-> Nested Loop Join (inner)
-> Filter
-> Table "INVOICEH" as "IH" Full Scan
-> Filter
-> Table "PAYMENTSH" as "PH" Access By ID
-> Bitmap Or
-> Bitmap
-> Index "IDX_PAYMENTSH_MASTERDOC_DESC" Range Scan (full match)
-> Bitmap
-> Index "IDX_PAYMENTSH_MASTERDOC_DESC" Range Scan (full match)
-> Filter
-> Table "PAYMENTSDETAILS" as "PD" Access By ID
-> Bitmap
-> Index "PK_PD_MOMENT_GENEMPID" Unique Scan
Customer states that second plan leads to performance problem.
Additional data from customer:
- number of records per tables:
table_name rec_count
==============================
InvoiceH 953779
PaymentsDetails 783127
PaymentsH 30408945
- index statistics (only for those indices that are involved in above shown query):
paymentsdetails
pk_pd_moment_genempid 0.00000127693203921808163
aaa_pd_periodfromdate 0.00104058277793228626
paymentsh:
idx_paymentsh_masterdoc_desc 0.00000011831024692651353
pk_paymentsh_moment_genempid 0.0000000329129825615837035
invoiceh:
pk_invoiceh_invid 0.00000104854007076937705
invoicehbyparentinvoiceiddesc 0.0000217893411900149658
Metadata
Metadata
Assignees
Labels
No labels