SQL Plans

As a DBA, you know that tuning SQL statements is a good place to start improving performance. If changes can be made to the code or available indexes, that is normally the quickest way to get results.

With SQL Server, you can get the execution plan from SQL Server Management Studio or by enabling showplan_all. This will provide information about the plan for which order to join the tables and the indexes to use.

Oracle plans are available through the OEM tools, and they can be traced through SQL*Plus as well. The plans can be saved in the plan table or just seen in the output from the trace.

Viewing Explain Plans

Let’s first look at a quick way to use SQL*Plus to see the explain plan for a query.

## To see query results and the execution plan set autotrace ...

Get Oracle Database Administration for Microsoft SQL Server DBAs now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.