Friday, 29 January 2021

Optimization of SQL Queries: Cons of Multiple Storage Engines



Among the big advantages advertised for MySQL includes support for several storage engines. This seems like an excellent advantage at first glance because users gain the advantage of using the same high-level SQL interface, enabling them to save their information in numerous ways.   

Though it may seem quite useful, this advantage comes at a high expense in terms of performance, growth, and operational intricacy. In this post, we will discuss just a few challenges of this particular feature.  

Cons of Multiple Storage Engines in Oracle\MySQL Databases 

Consider the following setbacks due to the support provided for multiple storage engines in Oracle queries - 



  • Conversions – Every storage engine contains its unique format for storing data, so MySQL performance tuning requires plenty of copying and conversions when it needs to access the information. This has a substantial impact on performance in comparison with a “zero-copy” design, where users may stream information from memory when it can be accommodated there. Optimizer and Execution Storage engines are not created equal especially if you look at In-Memory storage engines vs Distributed ones. 


  • Managing many different instances in query optimizer - Certain tasks and cases like clustering by The primary key in Innodb, the memory-based characteristics of the MEMORY storage engine and the distributed nature of NDB tend to get more complicated than necessary. This is due to the need to cater to several use cases that keep MySQL from exploiting the proper performance potential of either of the storage engines. 


  • Integration and Synchronization - The upper-most level at the MySQL side that includes .frm and binary log files require synchronization with storage engine transactions. This, in turn, takes up significant performance overhead and gets rather complicated. Also, despite MySQL doing numerous fsync() calls for each transaction commit just to remain on the safe side, many tasks still aren’t completely safe. For example, .frm files can be retrieved from the internal data dictionary in case of a crash at an inopportune moment. 



  • Transaction Assistance - There are several combinations of locks that users need to manage on higher levels and inside storage engines. They also have to deal with varying locking strategies owned by storage engines, which can lead to plenty of surprises if they choose to venture into the cross storage engine transactions.


  • Backup - Backing up data across storage engines can be frustrating due to their differences. While some of these storage engines are distributed, others use the memory, which means even versatile approaches such as LVM backup could fail in some situations.  

Query Optimization & Multiple Storage Engines - Final Thoughts

It is interesting to note that a single storage engine is more than sufficient for over ninety-five percent of applications that use SQL tuning for Oracle. Moreover, most users already prefer to use only one storage engine instead of mixing multiple of them because of the hindrances mentioned above. 

At the same time, this doesn’t mean users should give up flexibility altogether. For instance, administrators can enable InnoDB tables that don’t log changes, which will increase the rate of update operations. They may also lock those tables in memory to make sure the in-memory performance doesn’t get unpredictable.











Monday, 18 January 2021

Delayed Flushing & Its Role in MySQL SQL Performance Tuning


Fact: delayed flushing may actually lead to reduced load. It may sound hard to believe, but if you ask an expert about the reasons behind systems delaying flushing changes to durable storage, you might get one or both of these answers:

  1. In order to complete the task at a more convenient time
  2. To have less work overall

In this post, we will examine the second reason and whether it helps MySQL SQL performance tuning.


Higher Peak & Average IO Rates with Adaptive Flush

The total number of I/O operations performed definitely improves with adaptive flushing. What happens here is, the workload gets smoothed out by adaptive flushing, which results in more work getting done.

Why does this happen? As you might recall, InnoDB works on 16kb pages at a time. Suppose one of the users manipulates the data of one of the rows. If InnoDB flushes constantly, it will flush the whole 16kb page right then. Just after this flush, a different row undergoes changes on the same page, which causes one more page flush.

If the first flush were to be delayed, the two flushes would be performed as a single flush. Delaying a flush to perform along with other flushes as one flush is known as write combining in MySQL database and SQL.

In certain workloads, the same rows may end up getting updated numerous times, which is where delaying and allowing write combining may dramatically reduce the quantity of I/O operations.

Does Recovery Time Affect this Result?

Some of us might think that recovery time is a significant factor for MySQL SQL performance tuning, and that enabling this option is not really necessary if that isn’t the case. However, it actually depends on the workload, and if each flush takes up a resource that is also required by another task.

If the data is able to fit in the buffer pool, and no read operations are taking place at that moment - which means the disk isn’t required for any other operations - the disk would only be in use for write operations. Also, if everything is ready at the OS and RAID controller layers, a read operation won’t be needed for a write either, helping Oracle database performance tuning.

An important point to remember is that other than a mutex contention inside MySQL or InnoDB, write operations typically run in the background - so they don’t block foreground tasks.



 

 

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. 



Wednesday, 25 November 2020

SQL Tuning for Oracle: Examining the 1st Step in SQL Server


Before you set out fixing something, you need to know precisely what’s causing the problem. Otherwise, your efforts and resources are more likely to be wasted. 

For instance, a doctor cannot prescribe something until they have made a diagnosis, and this is also true for your organization’s database. In this case, the first step towards SQL tuning for Oracle is a detailed health check.


Oracle Performance Tuning Tips: More About SQL Server Health Check 


A health check in SQL Server is a comprehensive, detailed inspection of the database, including its settings, equipment, functioning, soundness, fallback strategy, and additional requirements. It informs your Database Administrator of what’s running fine, helps them pick out the problem-causing entities, and create a plan for strengthening. 


As a database professional, you may find a lot of the results and details in a health check report, but it is also important that the report yield action-oriented information. This, along with some useful Oracle performance tuning tips, should prove useful as it will bring you one step closer to the solution to your SQL Server related issues. 


At the same time, you need to analyze if the reports you are getting are accurate and easy to understand, or not. Preferably, a health check will not only enable you to uncover problems, but it will also help you with guidance on how to fix them.



How a Health Check Helps in Oracle Database Performance Tuning


Here are the various advantages of opting for a health check for your database - 


  • Eliminates Unwanted Surprises - A SQL Server database is highly complex, yet it is a crucial part of your business. There are several things that could go wrong at any given time, and simply contemplating this is enough to ensure sleepless nights. With a detailed health check, however, you will know all there is to know about your database, and be better equipped to decide whether your database requires Oracle database performance tuning or not.


  • Helps Creates a Decent Strategy - The health check you perform will uncover all the issues that need fixing straightaway as well as those that have more time to be worked upon. Also, it will give you a roadmap that will enable you to make minor adjustments, hasten slower processes that are creating performance related problems, and arrange them into a clear strategy, based on the order of priorities.


  • Long-Run Performance - A vital aspect of every health check is a review of present as well as long-term scalability in terms of performance. It helps the DBA comprehend the amount of load the current environment can handle without affecting its performance. 


Additionally, they will know about the scaling requirements, and whether SQL tuning for Oracle is needed, all of which helps them prepare for the organization’s requirements for the long haul.

  • Fresh Perspective - Regardless of whether you have an in-house Database Administrator or not, you gain a new perspective that will help you assess your database problems and create simple fixes. 

Although SQL Server database administration requires a lot of study, it also offers multiple approaches for an issue. The job of a DBA is to identify the best way around a difficult situation.




Monday, 14 September 2020

Multiple Clustering Indexes & MySQL SQL Performance Tuning

A clustering index is a different type of index that contains the entire data for the rows. Users gain quicker access to rows through clustered indexes because all of the data is on the page reached through the index search.

For bigger tables, the clustered index decreases the number of disk operations, especially in the case of companies that use the index record to save row data on different pages. If you understand the workings of clustered indexes, you can improve MySQL SQL performance tuning as well, which is why we are discussing them in this blog. 



Improving MySQL SQL Performance Tuning: Understanding How Clustered Indexes Work

A majority of storage engines support a maximum of one clustered index per table. While some do not support them at all, others only enable the primary key to become a clustered index. However, functionality and grammar syntax have evolved throughout these years, so users can enhance MySQL SQL performance tuning with the help of such means.

So, how do clustering keys operate? A clustering index basically stores a copy of the whole row and data is typically clustered with a primary key. Therefore, lookups are not considered in the primary index, since a clustering index covers all the queries. In a way, it is the implementing of a table in a different set up.


Clustering indexes have significantly shorter key lengths which is advantageous in terms of performance - they allow quicker insertions as compared to those in covering indexes. Non-MySQL databases also support the inclusion of monkey columns inside an index by offering syntax accordingly. Clustering indexes can also be thought of as exceptional cases under which every column is combined in the form of a nonkey column. 

Some experts may even point out that extra leaves are only saved in B-tree leaves instead of the internal nodes, but it may be helpful in case the size of the row is bigger than that of the key.

Final Thoughts

A clustering index can easily offer the advantages of covering indexes in a convenient way, apart from improving MySQL SQL performance tuning by their implementation. 

It also provides instant performance benefits that could otherwise be tough or unattainable to gain through simple covering indexes. Some databases can regulate indexes during the process of adding information a degree of parameter quicker than different storage engines. They can also compress data, which further raises the value of clustering keys.




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.




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. 

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