Query regarding tkprof output and cardinality in it [message #490352] |
Mon, 24 January 2011 04:50 |
OraKaran
Messages: 183 Registered: March 2008 Location: United Kingdom
|
Senior Member |
|
|
Please refer the following sqls and the results of the trace
As we can see in the plan 'TABLE ACCESS FULL T1' is the first step in the execution of the query
While we have set the num rows to 1000000 why we can't see them in the plan and instead it is showing only 10 rows
Also why I am unable to see cardinality in the plan
I have checked the statistic setting
timed_statistics boolean TRUE
statistics_level string TYPICAL
create table t1 as select 1 x, level y from dual connect by level <= 10;
create table t2 (x int primary key, z int );
insert into t2 values ( 1, 0 );
exec dbms_stats.set_table_stats( user, 'T1', numrows => 1000000, numblks => 10000 );
exec dbms_stats.set_table_stats( user, 'T2', numrows => 1000000, numblks => 10000 );
Then I executed following query
select /*+ first_rows(10) */ * from t1, t2 where t1.x = t2.x;
and below is the related trace
select /*+ first_rows(10) */ *
from t1, t2
where t1.x = t2.x
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.02 0 9 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 0.00 0.00 1 16 0 10
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 4 0.00 0.02 1 25 0 10
Misses in library cache during parse: 1
Optimizer mode: FIRST_ROWS
Parsing user id: 5
Rows Row Source Operation
------- ---------------------------------------------------
10 NESTED LOOPS (cr=16 pr=1 pw=0 time=200 us)
10 TABLE ACCESS FULL T1 (cr=4 pr=1 pw=0 time=193 us)
10 TABLE ACCESS BY INDEX ROWID T2 (cr=12 pr=0 pw=0 time=153 us)
10 INDEX UNIQUE SCAN SYS_C0096225 (cr=2 pr=0 pw=0 time=80 us)(object id 4669518)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
db file sequential read 1 0.00 0.00
SQL*Net message from client 2 9.31 9.31
********************************************************************************
Regards,
OraKaran
|
|
|
|
Re: Query regarding tkprof output and cardinality in it [message #490373 is a reply to message #490367] |
Mon, 24 January 2011 05:36 |
OraKaran
Messages: 183 Registered: March 2008 Location: United Kingdom
|
Senior Member |
|
|
Michel
Thanks for the quick reply
It is not clear to me
1)Do you mean actual plan overlooks the stats set by dbms_stat.set_table_stats?
And because of this the table T1 which is Fully scanned as a first step will show acual rows scanned regardless of whatever we set?
2) Why I am unable to see "card" in "row source generation"?
Regards,
OraKaran
|
|
|
|
|