Friday, 26 June 2020

SQL Plan Management Oracle- All Fundamentals You Must Know

While you make any changes in the system parameters or upgrade the Oracle database, you will often notice some highly regressed SQL performance or queries. In such cases, you don’t have to panic because it is quite obvious and happens with many whenever any plan gets changed. But the question is- how will you overcome such a nightmare? Well, it’s not that hard. You can use SQL plan management Oracle. 

Monday, 9 March 2020

SQL Plan Management Oracle- How to Create SQL Plan Baselines


Have you ever experienced performance regressions because of some drastic changes in the execution plan? If so, then we have brought to you a smart solution known as SQL Plan Management (SPM). SQL plan management Oracle is a deterrent mechanism that allows the optimizer to automatically handle execution plans while assuring that the database utilizes only verified and known plans.
The execution plan mainly changes because of several system changes. For instance, you might have changed a few optimizer-related parameters or updated stats for some objects manually or automatically. The more substantial change is the database upgrade. These changes can lead to the generation of new execution plans for many of your SQL statements. While some new plans are improvements, some of them are worse that leads to performance regression.
SQL Plan Management (SPM)
SPM enables database users to manage stable yet optimal performance for a set of SQL statements. Further, it incorporates the positive features of plan stability and adaptability, while simultaneously dodging their shortcomings. SPM has two key objectives:
Offering performance improvement by gracefully accepting database changes, and
Preventing performance regressions in the face of any changes in the database system. 
A managed SQL statement has an enabled SPM system. SQL plan management Oracle can be controlled manually either partially or wholly or be configured to work automatically. SPM prevents performance regressions by allowing the detection of plan changes for managed SQL statements. For this purpose, SPM manages, on disk, a plan history that comprises distinct execution plans generated for every maintained SQL statement.

Oracle optimizer’s advanced version, SPM aware optimizer uses, accesses, and manages information stored in a repository called the SMB (SQL Management Base). The plan history lets the SPM aware optimizer to identify whether the produced best-cost plan utilizing the cost-based method is a brand new plan or not. A brand new plan outlines a plan changes that can cause a performance regression.
The SPM aware optimizer doesn’t pick a brand new best-cost plan. Instead, it picks from a set of accepted plans called an SQL plan baseline that represents a subset of the plan history. These accepted plans have been either designated to hold good performance or verified to not cause a performance regression. A brand new plan is combined with the plan history as a non-accepted plan. Later, an SPM utility determines its performance and holds it as an accepted plan if it improves the performance or as a non-accepted plan if it reduces the performance.
The plan performance verification method ascertains both plan adaptability and stability. A SQL plan baseline can be created in several ways-
1.     Using a SQL Tuning Set (STS);
2.     From the cursor cache;
3.     Using a staging table; and
4.     Automatically.
SQL plan baselines from STS
If you are upgrading your Oracle Server, you might have an existing STS containing some or all your SQL statements. This STS might include a plan that works satisfactorily.
SQL Plan Baselines from the Cursor Cache
For any cursor that is present in the cache, SQL plan baselines can be automatically created. This lets you create SQL plan baselines for all every statement whose text is similar to the specified string. Various overloaded variations of such function enable you to filter on other cursor features.
SQL plan baselines using a staging table
If you have SQL plan baselines, you can export them to another system. Firstly, create a staging table and pack the SQL plan baselines you need to export. This will pack all SQL plan baselines for statements that match the certain filter. MY_STGTAB, the staging table is a regular table that you must export to the production system with the use of Datapump Export.
On the production system, for creating the SQL plan baselines, you can now unpack the staging table. You must note that the filter for unpacking the staging table isn’t mandatory, it’s optional. Plus, it may be distinct from the one utilized during packing which implies that various SQL plan baselines can be packed into a staging table and selectively unpack only a subset of them on the target system.
Creating SQL plan baselines automatically
SQL plan baselines can also be created automatically for every statement that is repeatable by setting the parameter optimizer_capture_sql_plan_baselines to TRUE (Note: default is FALSE). For any statement, the first plan captured is accepted automatically and becomes part of the SQL plan baseline. Therefore, you must enable this parameter only when you are certain that the default plans perform well. The automatic plan capture mode can only be used when the previous database version is upgraded to a new one.
By now, we expect that you have understood how SQL plan management oracle can be used to create SQL plan baseline. Also, SPM is one of the best oracle SQL query optimization techniques that avoid performance regression.


Monday, 6 January 2020

Top 5 Best Practices To Improve SQL Database Performance Tuning

improve SQL query performance

Database Tuning refers to a group of activities used for homogenizing and optimizing the performance of a database. Usually, it protrudes with query tuning but describes the design of the database files, configuration of the databases’ environment such as CPU, operating systems, etc., and configuration of the DBMS (Database Management System) application. 
Mainly, the database performance tuning is done to maximize the use of system resources so that application or the system works faster and efficiently as possible. Most systems are designed in a way that they can manage their use of system resources. However, in order to improve their efficiency, there still exists room for improvement which can be done by configuring the database and the DBMS and customizing their settings.
oracle sql query optimization techniquesToday, we are going to learn some of the best practices implemented by the DBAs and developers to improve SQL query performance or database performance. Here you go-
Creating Optimized Indexes
Indexing acts as a backbone for any RDBMS (relational database management system). No index directly impacts the functioning of a SELECT statement, while the queries will slow down if you put an excess of indexes. The fields and their order in indexing play a vital role during the database performance tuning. While indexing, the most important information to consider is the number of unique values present in a column of the table. For instance, thousands of first names in a column might maximize specific SELECT statements but it also introduce extra index retrieval time due to the big index pages. Therefore, it’s essential to optimize the index to balance between the two processing times. 
Pre-determine the Expected Growth
sql query optimization tool onlineIndexes create a negative impact on DML (INSERT, UPDATE, and DELETE) queries. When an index is created, the data for indexed columns gets stored on the disk. When the values in the indexed column are changed or new rows of data are inserted into the table, the database needs to reorganize the data storage to create room for the new rows. The reorganization of data storage can take extra troll on DML queries. However, if you need new rows in any table on a frequent basis, you need to specify the expected growth for an index. Also, the terminology for the predetermined growth varies in every database.
Select Limited Data
The less data you retrieve, the faster the query runs. Instead of filtering on the client, add as much filters you can on the server-end. As a result, less data will be sent on the wire and you will get results much faster. Try to eradicate any computed or obvious columns.
Avoid Foreign Key Constraints
sql query optimization tool online
The term is mainly used for ensuring data integrity. But, in turn, it affects the performance of your database. So, if your first priority includes performance, you need to modify the process of database performance tuning. The best example of a database avoiding the foreign key constraints is the system tables containing meta-data information about the user databases. However, it is seen that most users are concerned about data integrity. In such cases, they perform the data integrity process in the application layer and use foreign key only in development or QA environment as an error detection feature. This method will not affect the database performance and the data integrity is also protected. 
No Indexes before Loading Data
Dropping indexes on a table before loading a large quantity of data allows the INSERT statement to run faster. Once the insert is completed, it can be re-indexed. You can use a temporary table to load data when thousands of rows in an online system is being inserted. Also, ensure that this temp table doesn’t contain any index. 


oracle database performance tuning

Wednesday, 20 November 2019

SQL Performance Tuning for Developers: 3 Practical Tips



When you are working with large scale data, then even the most minor change made by you in the database may have a dramatic impact on the performance. The impact could be both positive and negative. In such situations, SQL performance tuning can be an incredibly challenging task.
Typically, a Database Administrator or DBA handles most of the SQL performance tunings in mid-sized and large companies. However, most of the companies with DBAs strive hard to work in sync with developers. The problem-solving modes of both the teams are different which often leads to conflict among the co-workers.
As a result, companies have to depart them and let them work separately with their own techniques. However, for better performance tuning, both teams need to work together for an effective result. In this blog, we are going to learn three important tips that will help in tuning SQL performance tuning.
Top Three Experimented Techniques for SQL Performance Tuning
 Without much ado, let us look at these three important tips to tuning:
Tip 1: Generation of an Actual Execution Plan

An SQL Server Management tool is crucial for generating graphical execution plans as well as for creating indexes. One can generate the actual execution plan only after the queries run. But the question arises- how will you generate it?
You need to simply click on ‘Include Actual Execution Plan’ or CTRL + M before running your query. Later on, a new tab will appear namely ‘Execution Plan’ where you will find a missing index. Ultimately, you have to right-click and select the ‘Missing Index Details’ in the execution plan and you’re all done.
Tip 2: Indexing
Through indexing, you can effectively tune your SQL performance. However, most of the developers often neglect it during the development process. An index is a data structure that provides efficient access of ordered records and random rapid lookups to upgrade the speed of data retrieval operations.

It implies that once an index has been created, you can sort or select your rows even faster. Furthermore, indexes also define the unique index or primary key to ascertain no other columns hold the same value.
Tip 3: Discover Slow Queries with SQL DMVs
DMV (Dynamic Management Views) are built into SQL Server and is one of the most significant features of SQL Server. They are in dozens and render a wide range of information pertaining to various topics. Several DVMs offer data about execution plans, recent queries, query stats, and more. These data can be combined together to obtain some astonishing insights.

Final Thoughts

So, for the next time, you need to improve the SQL performance tuning, you will have these three essential techniques at your fingertip. However, there are several other tips as well that can upgrade to the performance of your SQL server.
But before opting for any SQL tuning products, you must ensure the type of SQL performance functionality the product has built-in. There are several SQL tuning products available in the market but they aren’t useful to you until you have an in-depth knowledge of the same.
Tosska provides a one-button-solution tool to automatically tune the SQL statements without the need for users’ intervention. It offers various other tools to cope up with different issues related to SQL performance tuning. Therefore, you must look once into its products.


Friday, 11 October 2019

Guidelines for SQL Performance Tuning Every DBA Must Know


oracle sql performance tuning

One thing that every database admin dreads is to receive a barrage of calls from disgruntled users protesting about the slow performance of their database online. Ideally, SQL performance tuning is among the most helpful methods to determine the cause for delays when the system gets too slow or unresponsive. It can also maintain your infrastructure’s ability to manage greater loads. 

SQL performance tuning: Most Important Tips
In case your database is not performing as well as it should, there are many strategies you can apply in order to repair any potential causes. Let’s take a look at these five SQL performance tuning tips to ensure that you can make the most of the database hardware and keep everything completely functional. 

Why Baselines are Essential
oracle sql performance tuningSustaining a specific performance baseline is one of the best ways to tune your database’s performance. This is because you will be able to refer to it in case you suspect an issue. By conveniently determining peak phases of usage, you can assign performance benchmarks and be sure of the particular capabilities of the system in question.

Moreover, you need to evaluate the current performance of your database on a consistent and regular basis as it offers accurate expectations of how it is supposed to operate. This is quite useful in the event of tuning any hindrances which you are sure to encounter in the future. 

Using the Automatic Workload Repository to Monitor your Database
The AWR or the Automatic Workload Repository is probably the most valuable SQL performance tuning features. It not only gathers but also processes and maintains all the statistics related to database performance.

SQL performance tuning

As a monitoring tool, it provides frequent insights into your database’s functioning. These stats can help you make use of the ADDM or the Automatic Database Diagnostic Monitor to gain further details about the information shared by the AWR. Using both the AWR and the ADDM will greatly improve your SQL performance tuning capabilities and conserve resources at the same time.

Monitoring your figures is Important for Tracking Performance
Apart from utilizing the features mentioned above, you need to maintain a complete collection of statistics for the operating system, software as well as the database at all times. SQL query performance tuning is not just repairing a few issues; it must be one of the main components across the complete life cycle of any software.

The most efficient way of doing this is to repeatedly verify your statistics and making adjustments in the way they are collected as well as presented. The signs of performance issues are often discovered in the data, which is why you cannot neglect the details that can be the decisive element in honing your performance tuning skills. 
SQL performance tuning


Make sure that the CPU is Optimally Used
There are certain times when the automatic diagnostic functionalities simply aren’t good enough for fixing the issue at hand. That is when you may need to use manual methods for tuning. Whenever you are analyzing situations like these, you must keep an eye on whether the CPU is being sufficiently utilized or not. 

Keeping a check on the number of CPU resources being used in the user space will confirm whether there are any unrelated processes keeping its utilization limited. In other words, you can find out if there are any other tasks that are consuming system resources. Once you have determined CPU utilization, it gets a lot simpler to handle any problems related to SQL performance tuning, which further simplifies your process of making decisions. 

Enhance Oracle Analysis through SQL performance tuning
Although SQL is thought to be more of a messaging language since queries are entered and information is received in return, there are client tools that are unable to create efficient SQL queries. As a result, these badly-written SQL queries affect the performance of your database in a negative manner.

Strengthen your evaluation system with the help of our tuning tools to enact performance tuning and head over to our website to see how we can assist you in effectively monitoring your Oracle databases.

database performance tuning


What do You Mean by Oracle Performance Tuning?

Performance tuning is a process in which we fine-tune a database to improve its operational performance. This process includes working on pe...