Showing posts with label sql performance tuning. Show all posts
Showing posts with label sql performance tuning. Show all posts

Tuesday, 22 December 2020

SQL Performance Monitoring: Opting for a Correlated View

One of the issues users face is sporadic high CPU usage by their SQL Server, which leads them into a frenzied search of the queries creating this problem.

If you’ve come across such a situation, you may have considered starting up Perfmon (Windows Performance Monitor). Perfmon displays each occurrence of said spikes along with the exact CPU usage in each instance.

SQL Performance Monitoring Using Perfmon

It won’t display the code causing such spikes, but that’s not much to worry about, especially if you want SQL performance monitoring. This is because you already have a free graphical tool that can display both - the CPU usage spikes and the code that’s causing them.

Take a look at the following steps to use this ‘free’ tool -

Step 1: Correlate data. A correlation can be performed between Perfmon output and trace information to get the view required to fix this issue. This proves quite useful because when you click anywhere on the lower graph, you jump to the corresponding code in the upper tabular trace data being executed in that moment.

You will also find buttons to take the user to the topmost and bottommost values for any perfmon counter in particular. These are particularly helpful in database query optimization.

Step 2: Create the Perfmon counter log and Profiler trace file. However, doing all this requires the creation of a Perfmon counter log as well as a Profiler trace that must run simultaneously. The Profiler trace file has to have the “startdate” column along with the metrics you need.

Note: Although DBAs usually have experience with traces, in case you are just starting out, you can simply go for a database query optimization tool straightaway.

Step 3: Load the Perfmon file into Profiler. To do this, just open Profiler and load the trace file created in Step 2. From there, choose the option that says “Import Performance Data” in the File menu. You will have to locate the newly created Perfmon file.

Tip: Once you get to this point, you will be able to choose all the Perfmon metrics you want to view in graphical form. However, choosing only a few at a time is recommended, because the graphic window is rather small to fit more, and it can get too congested and unreadable if you try to display too many metrics. Also, you need to visit Import Performance Data again in order to adjust your selection.

Final Thoughts

Experts always find it surprising when they visit client sites only to find a considerable number of otherwise-knowledgeable SQL professionals unaware of this interoperability between such popular and extensively used monitoring apps.

Therefore, as a DBA, you may want to follow the three tips given below and avoid such ignorance:

      Inculcate the fundamentals into your development environment. Ensure that both - the app developers as well as the Database Administrators comprehend the steps mentioned above to use SQL performance tuning to its fullest.

      Begin application construction with database performance in mind.

      Make sure you own a convenient, automated method of locating and resolving poorly performing SQL queries.

These are as simple as they sound, which is why it’s surprising when many companies fail at these three simple things. 



Thursday, 9 July 2020

Oracle Database and SQL: Know More about Them


Prior to our discussion about the various functions and features that databases have to offer, we need to understand what they are and why we require them in the first place. This blog is aimed at discussing all these aspects in order to develop a sound understanding of Oracle database and SQL performance tuning in the long run. 

What is the Oracle Database and SQL Required for?

Data on a computer needs to be stored somewhere in order to be accessed whenever it will be needed in the future. From basic information related to the goings-on at a retail store, such as employee information, customer’s purchase history, transaction details, etc., to the employee records at an organization, data can be stored in different formats depending on the nature of the information - letters, digits, audio, video, images, and so on. 

One of the first ideas to occur in terms of data recording is opening up a spreadsheet. However, large amounts of information are much more convenient to store in a way that makes it easier to access any piece of it within a fraction of a second. 

And that way is a database. Moreover, when you have thousands of records to store at a single place, where some of that information may also be sensitive, you need a mode of data storage that is not only safe for private data but also prevents you from entering the exact same information repeatedly (duplication of data). 

A database is a well-organized system of storing your data with a set of rules decided by the user. The rules and structures defining the data are shifted as per the organization’s requirements. For instance, some may need to store a greater amount of data, whereas others may not have a large quantity of data but the amount of information that they have is sensitive and needs protective measures.

These aspects are managed by the database in the background to ensure that the data is completely secure and accessible only to certain individuals with the right credentials. Also, data integrity is established along with reliable means to retrieve said information in a fast, reliable manner. Such a robust way of storing information makes Oracle database and SQL a useful means of storage for business organizations of all sizes, which is also because of its ability to serve several users simultaneously and keeping data safe in case of hardware and technical difficulties that lead to system crashes. 

Oracle Database and SQL: Performance Tuning for DBMS

In larger organizations, it is common to own multiple databases, and a database management system like Oracle database and SQL is one of the best ways to conveniently manage them at the same time. Like databases, one organization can also have more than one DBMS due to their varying features and the organization’s specific requirements in each department. 


The following are some of the different types of Database Management Systems available these days - 

  • RDBMS (Relational Database Management System)
  • NoSQL Database System
  • Object-Oriented Database System
  • Network Database System
  • Hierarchical Database System

RDBMS like Oracle database and MySQL is the most commonly used ones by organizations at present. They do a lot to improve data operations in an organization but need to be ‘tuned’ from time to time. 

This basically means that their performance can be affected by a few factors which experts knowledgeable in this regard, known as database administrators, are tasked to keep an eye on. SQL performance tuning is easy with the help of tools designed specifically for this task, such as those by Tosska Technologies Limited.




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...