Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see the SQL execution plan in Oracle?

Tags:

I'm learning about database indexes right now, and I'm trying to understand the efficiency of using them.

  • I'd like to see whether a specific query uses an index.
  • I want to actually see the difference between executing the query using an index and without using the index (so I want to see the execution plan for my query).

I am using sql+.

How do I see the execution plan and where can I found in it the information telling me whether my index was used or not?

like image 550
user1573640 Avatar asked Aug 03 '12 16:08

user1573640


People also ask

How do I view SQL execution plan?

On the SQL Server Management Studio toolbar, click Database Engine Query. You can also open an existing query and display the estimated execution plan by clicking the Open File toolbar button and locating the existing query. Enter the query for which you would like to display the actual execution plan.

Where are Oracle execution plans stored?

19.1. V$SQL_PLAN contains the execution plan for every statement stored in the cursor cache. Its definition is similar to the PLAN_TABLE .


1 Answers

Try using this code to first explain and then see the plan:

Explain the plan:

explain plan  for  select * from table_name where ...; 

See the plan:

select * from table(dbms_xplan.display); 

Edit: Removed the brackets

like image 162
Birupakhya Dash Avatar answered Oct 23 '22 01:10

Birupakhya Dash