13.05.2013 Views

Thanks for the question regarding "connect by ", versi

Thanks for the question regarding "connect by ", versi

Thanks for the question regarding "connect by ", versi

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

------- ------ -------- ---------- ---------- ---------- ---------- ----------<br />

Parse 1 0.00 0.00 0 0 0 0<br />

Execute 1 0.00 0.00 0 0 0 0<br />

Fetch 2 0.00 0.00 0 5 0 2<br />

------- ------ -------- ---------- ---------- ---------- ---------- ---------total<br />

4 0.00 0.00 0 5 0 2<br />

Misses in library cache during parse: 1<br />

Optimizer mode: ALL_ROWS<br />

Parsing user id: 140<br />

Rows Row Source Operation<br />

------- ---------------------------------------------------<br />

2 CONNECT BY WITH FILTERING (cr=5 pr=0 pw=0 time=239 us)<br />

1 TABLE ACCESS BY INDEX ROWID JUNK (cr=2 pr=0 pw=0 time=61 us)<br />

1 INDEX RANGE SCAN JUNK_IND1 (cr=1 pr=0 pw=0 time=40 us)(object id<br />

1 NESTED LOOPS (cr=3 pr=0 pw=0 time=113 us)<br />

2 BUFFER SORT (cr=0 pr=0 pw=0 time=65 us)<br />

2 CONNECT BY PUMP (cr=0 pr=0 pw=0 time=29 us)<br />

1 TABLE ACCESS BY INDEX ROWID JUNK (cr=3 pr=0 pw=0 time=37 us)<br />

1 INDEX RANGE SCAN JUNK_IND1 (cr=2 pr=0 pw=0 time=24 us)(object id<br />

0 TABLE ACCESS FULL JUNK (cr=0 pr=0 pw=0 time=0 us)<br />

see <strong>the</strong> zero rows, cr=0, no activity - do you have a tkprof where <strong>the</strong> row source operation shows<br />

"not zero"<br />

yes ... but ... June 6, 2006 - 8pm Central time zone Bookmark | Bottom | Top<br />

Reviewer: Greg from Toronto<br />

Yeah .. but I'm not sure we're looking at <strong>the</strong> same thing! ;)<br />

In my original post, <strong>the</strong> set autotrace traceonly explain command spit out an explain <strong>for</strong>matted a<br />

bit different than yours (which is why I'm thinking I'm not looking at <strong>the</strong> right thing .. hehe) ...<br />

and it shows 8 rows on this one:<br />

| 9 | TABLE ACCESS FULL | JUNK | 8 | 40 | 2 (0)| 00:00:01 |<br />

I can try to re-run with:<br />

set autotrace traceonly statistics ??<br />

Followup June 6, 2006 - 9pm Central time zone:<br />

that is an autotrace, it is not "what happened".<br />

tkprof shows "what happened"<br />

Here is more in<strong>for</strong>mation:<br />

...<br />

The <strong>connect</strong> <strong>by</strong> row source uses a sort to store <strong>the</strong> rows it will be working on. If <strong>the</strong> filtering<br />

option is used, <strong>connect</strong> <strong>by</strong> needs <strong>the</strong> sort to detect duplicates as <strong>the</strong> rows are inserted into <strong>the</strong><br />

sort. If <strong>the</strong> sort spills to disk, it can no longer detect duplicates at <strong>the</strong> time <strong>the</strong> rows are<br />

inserted (<strong>the</strong> duplicates will be detected later, when <strong>the</strong> sort runs are merged). There<strong>for</strong>e if <strong>the</strong><br />

sort spills to disk, <strong>the</strong> <strong>connect</strong> <strong>by</strong> will switch to "no filtering" mode. The extra line in <strong>the</strong> plan<br />

is <strong>the</strong> row source that will be used if <strong>the</strong> switch to "no filtering" happens.<br />

.............<br />

Tree Walking from <strong>the</strong> result of a join June 14, 2006 - 2pm Central time zone<br />

Bookmark | Bottom | Top<br />

Reviewer: Mike Jones from England<br />

Help! I'm trying to write a Query where given a result set, one of <strong>the</strong> columns is an index into a<br />

hierarchy. I want to report <strong>the</strong> result set and <strong>the</strong>n each of <strong>the</strong> corresponding parents back up <strong>the</strong><br />

hierachy, sort of like reporting some in<strong>for</strong>mation about a person and <strong>the</strong>n each of <strong>the</strong>ir dad, and<br />

<strong>the</strong>n that person and <strong>the</strong>ir dads dad etc. all <strong>the</strong> way back up.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!