Last queries' execution stats.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sat, 10 Feb 2018 00:55:50 +0200
changeset 2226 d72d3ce66806
parent 2225 e7ffc0b15cd5
child 2227 1e9323e7ec88
Last queries' execution stats.
oracle.rst
--- a/oracle.rst	Sat Feb 10 00:25:27 2018 +0200
+++ b/oracle.rst	Sat Feb 10 00:55:50 2018 +0200
@@ -316,10 +316,14 @@
   grant CREATE PROCEDURE, CREATE TRIGGER to BOB;
   grant CREATE TABLE, CREATE SEQUENCE, CREATE VIEW, CREATE SYNONYM to BOB;
 
-Profiling.
-==========
+Profiling
+=========
 
-Timing info about last queries::
+Last queries' execution stats are available through ``v$sql`` view::
+
+  grant select on v_$sql to BOB;
+
+  select * from v$sql;
 
   select LAST_LOAD_TIME, ELAPSED_TIME, MODULE, SQL_TEXT elasped from v$sql
     order by LAST_LOAD_TIME desc
@@ -340,7 +344,7 @@
       order by LAST_LOAD_TIME desc
     ) where ROWNUM <= 5;
 
-In SQL/Plus::
+In SQL/Plus query execution time (up to )::
 
   SET TIMING ON;
   -- do stuff
@@ -369,6 +373,13 @@
   explain plan for ... SQL statement ...;
   select time from plan_table where id = 0;
 
+.. note::
+   From docs:
+
+     PLAN_TABLE is automatically created as a global temporary table to hold the output of an EXPLAIN
+     PLAN statement for all users. PLAN_TABLE is the default sample output table into which the
+     EXPLAIN PLAN statement inserts rows describing execution plans.
+
 See:
 
 http://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_2113.htm
@@ -452,3 +463,7 @@
 
   show errors;
 
+Modify output format::
+
+  set pagesize 40;
+  set linesize 400;