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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.