What exactly is PLAN_TABLE in Oracle Database?
Every user session on Oracle database will be able to access default table PLAN_TABLE to collect execution plan of a query from EXPLAIN PLAN command. But, how is this table available to all the users in the database and gets empty once you disconnect? Is this table available and created for every user logging into the database or is it a global table and available publicly to access? I am sure that you must have got little excited with these questions and we are going to get answers for many such questions in this blog with the help of a step-by-step analytic approach. In our earlier articles “EXPLAIN PLAN for multiple SQL statements”, “Ways of generating EXECUTION PLAN in Oracle Database” we have clearly understood the usage of PLAN_TABLE to generate execution plan for a query. In this blog, we are going to see what exactly is this PLAN_TABLE and all the concepts around its existence. Basics: Earlier to 11g, consider in 10g we will have to create this default table for EXPLAIN
PLAN runningutlxplan.sql file from $ORACLE_HOME/rdbms/admin. Let us read this file and understand what exactly is this PLAN_TABLE. [oracle@PT-DB ~]$ cd $ORACLE_HOME/rdbms/admin/utlxplan.sql create table PLAN_TABLE ( statement_id
varchar2(30),