SQL Performance Tuning: 5 Things to Do for Faster Results

query tuning in sql

Is your SQL Server falling behind in terms of performance? Are poorly-written queries slowing down your applications? Before you set out in search of professional help, make sure you’ve tried everything you could to resolve the issues you’re facing on your database. 

Many problems related to SQL Server can be handled easily with preventative maintenance, patches, and a few activities performed on a regular basis. You can always depend on our SQL performance tuning tools if nothing works for a particular situation. But before that, read the five important things you can do to fix database performance.

5 Things to Do for Effective SQL Performance Tuning

Given below are five simple things you can do to improve database performance:

Check if your SQL Server is up-to-date

An older query engine out of active development is bound to get you in performance-related trouble every now and then. Moreover, the newer versions have much better diagnostic support and will make things faster in multiple ways.

For starters, they come with new versions of the query optimizer. Although Microsoft provides a few tweaks here and there in its service packs, major version releases contain all the best improvements. Other advantages include:

  • Bug fixes
  • New CPU instruction sets
  • Latest software development techniques

Even a 32-bit to 64-bit upgrade can go a long way in improving database performance. This will help regardless of whether you are performing SQL tuning for Oracle or SQL Server.

Increase the Memory

Maxing out its memory will make a difference in its performance. This is because the database utilizes it to cache data instead of making additional trips to disk. Additionally, you gain more memory for cache query plans and can use it for larger sorts and joins. Another advantage is a potential decrease in disk and CPU utilisation, which further helps with SQL performance tuning. Just remember to raise the memory configuration in your SQL Server so it actually makes use of the new RAM.

Open Task Manager

If things remain slow after you’ve increased memory and upgraded your SQL Server,  it’s time to open Task Manager. Sort by CPU, followed by memory, and close any running apps, processes, or software that’s eating up space and you’re unaware of. Configure exceptions for antivirus software, if you have anything installed.

Windows may also be caching data for file system access, stealing RAM from server-side apps such as SQL Server. This can be checked by looking at the Cached number in the “Physical Memory (MB)” tab.

Check the Event Log

This includes both – the Windows Event Log and the SQL Server Log – as they both have potentially useful information. In case Windows or SQL Server are facing any sort of issue, these logs will certainly have more details about it.

You’ll know whether SQL Server is lagging due to hardware-related problems, facing long disk wait times, or dumping core. There may be other services with issues on the server that you can find out about here.

You can also read our post on SQL tuning for Oracle for some useful tips.

See if SQL Server alerts are set up

It is important to ensure these alerts are configured. They will, in turn, help you make sure you’re updated on everything that’s happening in SQL Server. As the person in charge of the database, you need to be aware in case the storage is falling short or other serious errors in SQL Server.

Selecting a SQL Server Database Version for Your Company

SQL Server database and SQL

Choosing the right version of SQL Server is important for the performance you desire. If you’re installing an older one because your organization’s management prefers an older build or the vendor is unable to support newer versions, it is important to let them know which version your company needs, and why.

For this reason, we will discuss some popular versions of SQL Server from older to newer and mention their advantages in this blog.

Which SQL Server Version Works Best with SQL Performance Tuning?

Knowing the versions that support this task is extremely important because it will give you the ability to improve the SQL Server database and SQL performance.

To that effect, we will discuss the SQL Server 2016, 2017, and 2019 versions here.

SQL Server 2016

This version was chosen by a lot of independent software vendors or ISVs for one reason – 2016’s Service Pack 1 edition came with Enterprise features in Standard mode. These helped create a single application version that worked simultaneously for both Standard as well as Enterprise clients.

Advantages of Choosing this Version:

  • It is easy to find support material online as this version is quite popular and numerous database professionals are well-versed with this version’s tools.
  • Standard Edition users may find this version appealing since it supports 128GB RAM and additional space for internal functions such as query plans.
  • Support for this version ends after 2026 – longer than the older versions (2012/2014).
  • Newer applications that have additional compliance requirements will benefit from features in this version such as Always Encrypted, temporal tables, and Dynamic Data Masking. These will make it somewhat easier to protect and monitor sensitive information.
  • You can have both row store and column store indexes in this version, unlike the earlier ones that only had row store indexes.
  • If you need query plan monitoring to help with SQL performance tuning, you can use the Query Store’s features provided in SQL Server 2016 for this purpose.

SQL Server 2017

Being a newer release, it is one of the most regularly updated versions with patches coming in almost every other month. These patches are important because they resolve significant problems. It also comes with a minimum commit replica configuration to ensure commits are accepted by several replicas.

Advantages of Choosing this Version:

  • The upgrades are easier to get from this version onward due to a Distributed Availability Group that contains multiple SQL Server versions in it. Before this, we had AG version upgrades that were not as convenient, leading most users to construct a new cluster and migrate to it rather than opt for an upgrade.
  • This version contains batch mode execution plans, which gives those who require high-performance column store statements an advantage.
  • If you must run your SQL Server on Linux, you may consider SQL Server 2017 as several bugs have been resolved in the Cumulative Updates.
  • It’s a newer version so support will last longer than that of its predecessor.

SQL Server 2019

Released on November 4, 2019, this version is the latest in the SQL Server series. Naturally, it comes with the longest support lifespan, i.e. it will be supported until 2030. This version also receives regular patch updates to fix many significant issues in the form of Cumulative Updates.

Changes and Features in this Version:

  • Patch contents aren’t documented anymore. Moreover, you are likely to receive updates with undocumented new features – something to consider in case you require it for mission-critical production environments.
  • There is a bit of a learning curve thanks to some cutting-edge features in this version, so be prepared to perform some experimentation as you learn.
  • Some of the best performance features are included in the 2019 compatibility mode. However, you will have to keep a close eye on all SQL Server databases and SQL queries – even the ones running fast at present – as these will alter your current execution plans. In other words, you will have to test both slow and fast queries to make sure the slow ones speed up and the fast ones don’t fall behind in performance.
  • Table variables have gotten better in this version along with user-defined functions.
  • Additional features to watch out for including Big Data Clusters, Java support, and high container availability, so you may want to explore this version if you’re looking for perks like these in the SQL Server you want.

In Conclusion

At this point, SQL Server 2017 might seem like the best version to go with, thanks to a balance of features, stability, and support lifespan. Furthermore, you’ll receive plenty of help with SQL performance tuning – a lifesaver for overworked professionals who may not have the time or resources to upgrade every server every year.

Tosska SQL Tuning Expert (TSES™) for SQL Server® – System Requirements

Before installing Tosska SQL Tuning Expert (TSES™) for SQL Server®, please make sure your system meets the following minimum hardware and software requirements:
 

CPU 1.8 GHz Processor
Memory 2 GB of RAM minimum, 4 GB of RAM recommended
Hard Disk Space 500 MB of disk space for 64-bit installation
Operating System Microsoft Windows® 7 64-bit
Microsoft Windows® 10 64-bit
.NET Framework Microsoft .NET Framework 4.5.0
Database Server SQL Server database 2005 or higher

Tosska SQL Tuning Expert (TSEM5™) for MySQL (5.1-5.5)® – System Requirements

Before installing Tosska SQL Tuning Expert (TSEM5™) for MySQL (5.1-5.5)®, please make sure your system meets the following minimum hardware and software requirements:
 

CPU 1.8 GHz Processor
Memory 2 GB of RAM minimum, 4 GB of RAM recommended
Hard Disk Space 400 MB of disk space for 64-bit installation
Operating System Microsoft Windows® 7 64-bit
Microsoft Windows® 10 64-bit
.NET Framework Microsoft .NET Framework 4.5.2
Database Server MySQL database 5.1 to 5.5