Here is the sqlplus scripting I use to check whether row chaining is degrading a query’s performance:
VARIABLE monitored_sid number; begin SELECT sid into :monitored_sid from v$session where audsid=USERENV('SESSIONID'); end; / select b.value "table fetch continued rows" from V$SESSTAT b where b.SID = :monitored_sid and b.STATISTIC# = (SELECT STATISTIC# FROM V$STATNAME WHERE NAME='table fetch continued row');
I create a test script with the problem query and put this code after it to see how much chaining affected it.
Here is an example of a fast query:
Elapsed: 00:00:15.87 table fetch continued rows -------------------------- 19723
Here is an example of a slow query:
Elapsed: 00:03:17.46 table fetch continued rows -------------------------- 23775056
This was the same query for two different date ranges. The second range had a lot of row chaining and the query was much slower.
– Bobby