Hi, All.
i try to reproduce smth like SQL+ autotrace option using v$sesstat.
i'm interested in parameters:recursive calls,db block gets,consistent gets,redo size.
so, i do:
----------------------
SELECT B.statistic#, A.name, B.value
FROM v$statname A, v$sesstat B
WHERE B.statistic#
IN (7,38,39,101)
AND A.statistic# = B.statistic#
and b.sid=12 -- my SQL+ session
order by B.statistic#
-----------------------
i do it before some query and after it, and substruct results. the query itself i do in traceonly mode:
-----------------------------
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 NESTED LOOPS
2 1 TABLE ACCESS (FULL) OF 'TABLE1'
3 1 TABLE ACCESS (BY INDEX ROWID) OF 'TABLE2'
4 3 INDEX (UNIQUE SCAN) OF 'TABLE2_PK' (UNIQUE)

Statistics
----------------------------------------------------------
0 recursive calls
12 db block gets
18 consistent gets
0 physical reads
0 redo size
...
-----------------------------
but v$sesstat gives very-VERY different results:
------------------------
recursive calls 126
db block gets 131
consistent gets 247
redo size 3120
-------------------------
Again: it's result of SUSTRUCTION.

Moreover, v$sesstat reports me changes in redo size, but as you can see from Execution Plan, i don't do any changes in tables.
Does anybody can explain the reasons of such differences and how it possible to do smth like this.