What is SQL plan in Oracle
Isabella Browning
Updated on April 17, 2026
SQL Plan Management (SPM) provides a framework for completely transparent controlled execution plan evolution. With SPM the optimizer automatically manages execution plans and ensures only known or verified plans are used.
What is SQL plan base line?
Defined, a SQL Plan Baseline is a set of one or more “accepted” plans that contain hints, the plan hash value and other plan related data. In addition to the actual baseline, Oracle also maintains a SQL Plan History. … A statement has had three different execution plans generated.
How explain plan works in Oracle?
Running EXPLAIN PLAN EXPLAIN PLAN FOR SELECT last_name FROM employees; This explains the plan into the PLAN_TABLE table. You can then select the execution plan from PLAN_TABLE . This is useful if you do not have any other plans in PLAN_TABLE , or if you only want to look at the last statement.
How do you plan in SQL?
- Hit “Ctrl + M” and it will generate the actual execution plan after the query has been executed successfully.
- Right-click on the query window and select “Display Actual Execution Plan” from the context menu.
What SQL is used in Oracle?
Oracle uses PL/SQL. SQL Server uses T-SQL.
How do I pin a SQL plan in Oracle?
- Run the Statement which you want to pin. SQL> SELECT ‘Example TEST’ FROM dual; …
- Check the Query in V$SQL. select substr(sql_text,1,15) Text,address,hash_value,KEPT_VERSIONS. …
- Pin the upper SQL with ADDRESS and HASH_VALUE parameter: …
- Check the Status of KEPT_VERSIONS.
What is SQL patch in Oracle?
A SQL patch is a SQL manageability object that can be generated by the SQL Repair Advisor, in order to circumvent a plan which causes a failure. In essence, a SQL patch tells the optimizer to change the plan in some way or avoid an optimization so that the failure does not occur.
What is the difference between explain plan and execution plan in Oracle?
An explain plan predicts how Oracle will process your query. An execution plan describes the steps it actually took.Why do we use execution plan?
Execution plan is generated by query optimizer. It tells us the flow of the query. Execution plan lets us know how a query will execute on the database engine to return some results.
What is cost in Explain plan in Oracle?Cost is the estimated amount of work the plan will do. A higher cardinality => you’re going to fetch more rows => you’re going to do more work => the query will take longer. Thus the cost is (usually) higher. All other things being equal, a query with a higher cost will use more resources and thus take longer to run.
Article first time published onWhat is Storage full in explain plan?
It refers to Exadata’s Smart Scan and cell offload capability – that part of the plan is being passed down to the storage tier which executes that part of the query.
What is full table scan in Oracle?
During a full table scan all the formatted blocks of a table that are below High Water Mark (HWM) are scanned sequentially, and every row is examined to determine if it satisfies the query’s where clause.
Where is explain plan in SQL Developer?
In SQL Developer, you don’t have to use EXPLAIN PLAN FOR statement. Press F10 or click the Explain Plan icon. It will be then displayed in the Explain Plan window.
What is difference between SQL and Oracle SQL?
Oracle, meanwhile, uses PL/SQL, or Procedural Language/SQL. Both are different “flavors” or dialects of SQL and both languages have different syntax and capabilities. The main difference between the two languages is how they handle variables, stored procedures, and built-in functions.
How SQL is different from Oracle?
Oracle is owned by Oracle Corporation and can run on a wide variety of platforms such as Windows, Linux, Solaris, HP-UX, and OS-X. Oracle supports PL/SQL and SQL language to write queries to access data from its database. SQL Server is owned by Microsoft and can only be used on the Windows platform.
What are the types of SQL?
- Data Definition Language (DDL) Statements.
- Data Manipulation Language (DML) Statements.
- Transaction Control Statements.
- Session Control Statements.
- System Control Statement.
- Embedded SQL Statements.
What is SQL Repair Advisor?
Oracle 11g introduced the SQL Repair Advisor to help diagnose and fix valid SQL statements that fail with critical errors at runtime. The advisor performs a diagnostic operation on the statement and may provide a patch to repair the statement.
How do I drop a SQL patch?
DROP_SQL_PATCH with the patch name to drop the SQL patch. The patch name can be obtained from the explain plan section or by querying the view DBA_SQL_PATCHES .
How do I know if a PSU patch is installed in a database?
- Listing Applied Patches. To print a summary of installed patches, you can can use opatch lspatches command. …
- Using opatch lsinventory. …
- Get detailed info Using opatch lsinventory.
What is SQL profile in Oracle?
A SQL profile is a set of auxiliary information specific to a SQL statement. Conceptually, a SQL profile is to a SQL statement what statistics are to a table or index. … This information can improve optimizer cardinality and selectivity estimates, which in turn leads the optimizer to select better plans.
What is SQL profile and baseline?
Think of it this way: SQL profiles give information to the optimizer to help select the best plan but don’t force the optimizer to select any specific plan. SQL plan baselines limit the optimizer plan selection to a set of accepted plans.
How do I force a plan in Oracle?
- Stored Outlines: Stored outlines will same an existing execution plan and force it to be used. …
- SQL Hints: Oracle hints are optimizer directives that can be used to force Oracle to always use the same execution plan for a SQL statement.
How is SQL executed?
Whenever SQL Server gets a query to execute it performs two major steps to return the query output. The first step is query compilation, which generates a query execution plan by the SQL Server relational engine and the second step is execution of the query execution plan by the SQL Server storage engine.
What is seek and scan in SQL?
Explanation. An index scan or table scan is when SQL Server has to scan the data or index pages to find the appropriate records. A scan is the opposite of a seek, where a seek uses the index to pinpoint the records that are needed to satisfy the query.
What is the difference between table scan and index scan?
Table scan means iterate over all table rows. Index scan means iterate over all index items, when item index meets search condition, table row is retrived through index. Usualy index scan is less expensive than a table scan because index is more flat than a table.
How a SQL query is executed in Oracle?
- Choose rows based on the WHERE clause.
- Group those rows together based on the GROUP BY clause.
- Calculate the results of the group functions for each group.
- Choose and eliminate groups based on the HAVING clause.
What is hard parsing in Oracle?
A hard parse occurs when a SQL statement has to be loaded into the shared pool. In this case, the Oracle Server has to allocate memory in the shared pool and parse the statement. Each time a particular SQL cursor is parsed, this count will increase by one.
How do I monitor sessions in SQL Developer?
- In SQL Developer, click Tools, then Monitor Sessions.
- In the Select Connection dialog box, select a connection to SYSTEM (or another account with full DBA privileges)
What does SQL cost mean?
It means how much it will “cost” you to run a specific SQL query in terms of CPU, IO, etc. For example Query A can cost you 1.2sec and Query B can cost you 1.8sec.
What is high cardinality in Oracle?
High-cardinality refers to columns with values that are very uncommon or unique. High-cardinality column values are typically identification numbers, email addresses, or user names. An example of a data table column with high-cardinality would be a USERS table with a column named USER_ID.
What is cost in SQL execution plan?
The cost column is essentially an estimate of the run-time for a given operation. In sum, the cost column is not valuable for SQL tuning, because the “best” execution plan may not be the one with the lowest cost.