
If you execute the previous SELECT query, including the Actual Execution Plan, the generated plan in our case will be like: The best way of tuning the previous query performance, is studying the SQL Execution Plan of that query.

Before starting with the first example, we will create two new tables using the CREATE TABLE T-SQL statements below:
#QUERY PERFORMANCE TUNING IN ORACLE 10G HOW TO#
To understand how to use a SQL Execution Plan in tuning the performance SQL queries, let us go through our practical demo. These messages are used to warn about different problems with the query to troubleshoot, such as tempdb spills issues, missing indexes or bad cardinality estimates. Another sign from the Execution Plan for a performance issue in the query, are the Execution Plan Warnings. Also, the Scan operators that are used for scanning the overall table or index, indicates most of the time that there is a missing index, the index is badly used, or the query contains no filtering condition. In addition, the fat arrows, that followed with thin ones, indicates large number of records being processed and flowed from one operator to the other to retrieve small number of records, could be also a sign for a missing index or data multiplication performance issue.Īfter understanding the role of each plan operator discussed in this series, you can recognize the extra operators that degrade the performance of the query due to its addition overhead. For example, the most expensive operator that has the highest cost, related to the overall query cost, is a good starting point for the query performance troubleshooting. There are number of general signs in the SQL Execution Plan that indicate potentially bad performance spots on the query. This is because the plan tells us what to tune, by showing how the query is internally executed with presentation for the execution road map, the most expensive part of the query, signs that help in writing the query in the best way and the recommended indexes. The first method that any database administrator recalls when thinking about the queries performance tuning is using SQL Execution Plans. SQL Server query performance tuning is considered as a top priority and an endless battle for database administrators to achieve the best performance for their managed systems, with the least resources consumption. In this article, we will show how we can use an Execution Plan in tuning the performance of T-SQL queries.
#QUERY PERFORMANCE TUNING IN ORACLE 10G SERIES#
Materialized views can be managed through Oracle Enterprise Manager.In the previous articles of this series (see the index at bottom), we went through many aspects of the SQL Execution Plan, where we discussed how the Execution Plan is generated internally, the different types of plans, the main components and operators and how to read and analyze the plans that are generated using different tools. Oracle Database 10g added query rewrite capabilities such that the optimizer can make use of multiple appropriate materialized views. A query at the quarter level might use monthly aggregates in the materialized view, selecting the months needed for the quarter(s). For instance, if a query can be answered by summary data based on sales by month, the query optimizer will automatically substitute the materialized view for the more granular table when processing the query.

The cost-based query optimizer can perform query rewrites to these summary tables and rollup levels in the hierarchy transparently, often resulting in dramatic increases in performance. A materialized view provides precomputed summary data most importantly, a materialized view is automatically substituted for a larger detailed table when appropriate. Materialized views were introduced for the creation of summary tables for facts and dimensions that can represent rollup levels in the hierarchies.
