Hi,
 
 
SELECT
..
FROM
 ZLEC_FAKT ZF
    INNER JOIN KONTRAHENT K ON ZF.DYR_ID=K.DYR_ID AND ZF.KONT_ID=K.KONT_ID
WHERE
ZF.ZLEC_FAKT_STATUS_ID=6 or ZF.ZLEC_FAKT_STATUS_ID=7
 
-------------------------------------------------------------------
in FB2.5
PLAN JOIN (ZF NATURAL, K INDEX (KONTRAHENT_PK))
 
-------------------------------------------------------------------
in FB3 
PLAN JOIN (K NATURAL, ZF INDEX (ZLEC_FAKT_FK3))
Executing statement...
Statement executed (elapsed time: 0.000s).
3643558 fetches, 0 marks, 0 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 1415964 index, 161062 seq.
Delta memory: 5152 bytes.
Total execution time: 2.543s
Script execution finished.
 
with plan from FB2.5 on FB3
PLAN JOIN (ZF NATURAL, K INDEX (KONTRAHENT_PK))
 
 
Executing statement...
Statement executed (elapsed time: 0.000s).
2869415 fetches, 0 marks, 0 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 284 index, 1415947 seq.
Delta memory: 5152 bytes.
Total execution time: 1.420s
Script execution finished.
 
-------------------------------------------------------------------
ZLEC_FAKT count 1 290 948 (ZLEC_FAKT_FK3    0.000012)
KONTRAHENT count 154 505 (KONTRAHENT_PK 0.000006)
 
-------------------------------------------------------------------
and in above query we have also non indexed filter on ZLEC_FAKT 
(ZF.ZLEC_FAKT_STATUS_ID=6 or ZF.ZLEC_FAKT_STATUS_ID=7)
 
What is the choice internals about which table should be taken first as natural?
And is non indexed filtering on table taken into account?
If you have not free time to explain this - then in which FB source file it is?
 
regards,
Karol Bieniaszewski
 
 
------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to