Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Physics of the FILTER operation within SQL_PLANE.
Good experiment.
The number of rows (in the rowsource) for the filter lines actually tell you how many times the filter operation took place - and you can confirm this (in 9.2.0.4, at any rate) by checking the last_starts column in view v$sql_plan_statistics.
I re-ran and modified you test, particularly the one with the 519 executions. Note that 519 'suggests' 19 values being cached and one value being re-queried repeatedly.
Results:
The break point in this test was 15.
If F2 in the main table cycled from 1 to 15, then the execution count of the filter was 15.
If F2 in the main table cycled from 1 to 16, then the execution count of the filter was 515 - i.e. 15 cached, and one re-cycled 500 times.
Results 2:
I increased the number of rows in the sub-table in stages, and increased the number of values in the main-table to keep up.
At 64 rows in the sub-table, and the value cycling from 1 to 64 in the main table, the executions of the filter was 3058. Which is 500 * 6 + (64 - 6). In other words - 58 cached, and 6 non-cached !
It may be possible to figure out exactly what's going on by varying the number of values - and perhaps the number of repetitions of the cycle. But it looks as if the algorithm is aimed at handling a small number of possible returns from the subquery.
Regards
Jonathan Lewis
http://www.jlcomp.demon.co.uk/faq/ind_faq.html The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/seminar.html Optimising Oracle Seminar - schedule updated May 1st
FILTER operation effectiveness depends on how (in which order) rows are
inserted into driving table. Looks similar to clustering factor in index
range scans ;)
Take a look on simple TESTCASE I have made on 9.2.0.4 Win2000.
As you can see LIO count defers by 17 times (First case 63 LIO, second
1061) depending on order how rows have been inserted.
One more effect, if we reduce row count in filter table (third test), then
Oracle execute filter operation more effective (LIO=43) independing of
inserting order, due to "remembering results of previous probes" probably.
Best regards,
Jurijs
TESTCASE
call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0 Execute 1 0.00 0.00 0 0 0 0 Fetch 2 0.10 0.11 0 63 0 1------- ------ -------- ---------- ---------- ---------- ----------
Misses in library cache during parse: 1
Optimizer mode: RULE
Parsing user id: SYS
Rows Row Source Operation
------- --------------------------------------------------- 1 SORT AGGREGATE (cr=63 r=0 w=0 time=111286 us)10000 FILTER (cr=63 r=0 w=0 time=86030 us) 10000 TABLE ACCESS FULL MAIN_TAB (cr=23 r=0 w=0 time=28758 us)
20 TABLE ACCESS BY INDEX ROWID FILTER_TAB (cr=40 r=0 w=0 time=425 us)
20 INDEX UNIQUE SCAN FILTER_TAB_I1 (cr=20 r=0 w=0 time=194 us)(object id 9669)
call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0 Execute 1 0.00 0.00 0 0 0 0 Fetch 2 0.12 0.12 0 1061 0 1------- ------ -------- ---------- ---------- ---------- ----------
Misses in library cache during parse: 1
Optimizer mode: RULE
Parsing user id: SYS
Rows Row Source Operation
------- --------------------------------------------------- 1 SORT AGGREGATE (cr=1061 r=0 w=0 time=129048 us)10000 FILTER (cr=1061 r=0 w=0 time=103463 us) 10000 TABLE ACCESS FULL MAIN_TAB (cr=23 r=0 w=0 time=28637 us) 519 TABLE ACCESS BY INDEX ROWID FILTER_TAB (cr=1038 r=0 w=0 time=8436 us)
519 INDEX UNIQUE SCAN FILTER_TAB_I1 (cr=519 r=0 w=0 time=3711 us)(object id 9666)
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.htmlReceived on Mon Jun 28 2004 - 15:45:44 CDT
-----------------------------------------------------------------