Saro Khatchatourian
Saro Khatchatourian

Reputation: 1047

Does Oracle have a means to show query execution plans like Sybase 'showplan'?

I am a Sybase DBA/performance optimizer and was asked to look into the performance of some SQL queries on Oracle and see what the problems are and why it is slow. Is there a showplan similar to Sybase? I need to get the number of physical i/o's and logical i/o's, table scans and indexes the query or stored procedure uses.

I used to use Embarcadero and I don't have that anymore.

Upvotes: 1

Views: 2947

Answers (2)

Rajesh Chamarthi
Rajesh Chamarthi

Reputation: 18808

Explain Plan and/or AutoTrace is the Oracle Equivalent which will give you the possible execution plan that Oracle will use if you execute the Query.

In SQLPLUS you could do this..

SQL> set autotrace traceonly;

SQL> select * from scott.emp;

14 rows selected.

Execution Plan
----------------------------------------------------------
Plan hash value: 3956160932

--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |    14 |   518 |     3   (0)| 00:00:01 |
|   1 |  TABLE ACCESS FULL| EMP  |    14 |   518 |     3   (0)| 00:00:01 |
--------------------------------------------------------------------------


Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
          8  consistent gets
          0  physical reads
          0  redo size
       1415  bytes sent via SQL*Net to client
        381  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
         14  rows processed

Here are various other options available depending on the level of detail and your specific scenario..

http://www.oracle-base.com/articles/10g/SQLTrace10046TrcsessAndTkprof10g.php

Upvotes: 4

Tridus
Tridus

Reputation: 5081

I'm not sure if all of that is available in it, but Oracle SQL Developer lets you put a query in and hit Explain Plan to see the execution plan. That includes what it's going to do and any indexes it's using.

It's a free tool, so give it a try. :)

Upvotes: 1

Related Questions