Index Seeks for better performance? Deep Dive on “Covering vs Non Covering Indexes”

Hi there,

A few days ago a client brought me a question, he had two tables with the same data, one in each database (same SQL version and compatibility level in different environments with similar infrastructure and configurations). Both tables had an extremely selective column and both had indexes in that column. The thing is that when running a particular query on one Database, let’s call it DB1 here, it was really fast whereas running the same query on the other database (DB2) it was a lot slower. The subset of rows that matched the WHERE clause was the same and it was really small in both cases (since the tables had the same data).

“Ok, let’s have a look at that”, I said, and when doing so, the query running on DB1 was doing a Clustered Index Seek whereas the same query in DB2 was doing a Table Scan. Didn’t I say that both tables had indexes in that column?

Continue reading “Index Seeks for better performance? Deep Dive on “Covering vs Non Covering Indexes””

Query Store Hints, how can it help in performance issues?

Hi there!

Last December I got lucky since after upgrading from SQL Server 2012 to 2022, one of my clients had a process running in a particular database that went from around 10 minutes to around 10 hours!

You might be thinking: “It got 60 times worse, where’s the luck in that?”

Well, it presented me with a great opportunity to try a new feature in SQL Server 2022 called “Query Store Hints” (in a real production environment) and confirm the fabulous results that can be obtained by using it, with no effort at all. I thought it could be worth to share this experience and that’s what I’ll present in this post ๐Ÿ™‚

Continue reading “Query Store Hints, how can it help in performance issues?”

Why you shouldn’t use the securityadmin role anymore

Hi there!

I usually avoid using the two “radical” words: “never” and “always” but regarding the membership need for the “securityadmin” server role since SQL 2005/2008 onward, I find it hard to come up with a good reason why it should ever be used, especially considering the security risks involved. A few weeks ago, while checking permissions for some logins in a (critical) SQL Server 2019 instance, I came across some really worrying situations, among which I found this one… again! Although it wasn’t the worst I found there (the worst was to bad to even mention here) I felt impelled to write about this one, maybe because the risks may not be so obvious or are somewhat concealed… Well, let’s bring them to light! ๐Ÿ™‚

Continue reading “Why you shouldn’t use the securityadmin role anymore”

The “hidden” benefits of Indexes in Foreign Key columns

Hi!

Let me start this post with a question, “Do you think that it can be beneficial to have a single column index for the foreign key column in the child table?“

Well, I believe I can ear three types of answers to this question:

  • Always!
  • Never!
  • It Depends…

Hmm, I guess we’ll have to find out which of these answers is the most appropriate and more importantly: why!

Continue reading “The “hidden” benefits of Indexes in Foreign Key columns”

A quick win via “Batch Mode on Rowstore” since SQL 2019

Hi!

Before 2012, creating analytical queries (that usually scan many rows and have lots of aggregations) from big OLTP databases to feed real-time based reports used in decision making processes, could be quite challenging. Then ColumnStore Indexes arrived and they’ve been enhanced overtime, offering amazing gains both in performance and storage.

Unfortunately, regarding pure OLTP databases, there are many situations in which ColumnStore Indexes can’t (or won’t) be used. There are some great performance enhancements present in columnstore that’s for sure and today I’m going to speak about one that became automatically available since SQL Server 2019 for “traditional” RowStore tables. It’s called “Batch Mode on Rowstore” and it can really boost some of our analytical queries over the “traditional tables” without any effort from our side!

Are you curious about this? Then read on ๐Ÿ™‚

Continue reading “A quick win via “Batch Mode on Rowstore” since SQL 2019″

HADR in Azure SQL Database (Part III)

Hi,

This is my third and last post dedicated to HADR solutions in Azure SQL Database, where I’ll introduce “Auto-failover groups“.

You can find the previous ones here:

So, first of all, what is Auto-failover groups?

Continue reading “HADR in Azure SQL Database (Part III)”

HADR in Azure SQL Database (Part II)

Hi,

This is the second of three posts dedicated to HADR solutions in Azure SQL Database. In HADR in Azure SQL Database (Part I) I presented the “Scale out read-only Database” feature. In this one, I’ll talk about Active Geo-Replication and in HADR in Azure SQL Database (Part III), I’ll introduce “Auto-failover groups”.

So, first of all, what is Active Geo-Replication?

Continue reading “HADR in Azure SQL Database (Part II)”

HADR in Azure SQL Database (Part I)

Hi,

AlwaysOn Availability Groups (AG) has been around since SQL Server 2012 and today it is widely used in HADR solutions. It also gives us the ability to have readable secondary replicas, allowing read-only access to the respective secondary databases. If you have read-intensive workloads (like reporting, ETL applications, etc.) you can have a significant performance benefit by simply directing those workloads to the secondary replicas.

In this post Iโ€™m assuming that youโ€™re already familiar with this โ€œoldโ€ feature so Iโ€™m not going to elaborate about it.

The thing is that AG is not present in Azure SQL Database (PaaS), so my purpose here is to show how to implement an HADR solution in Azure SQL Database, since we canโ€™t use our well known (and beloved) AG and youโ€™ll see that itโ€™s actually pretty easy ๐Ÿ˜Š

Continue reading “HADR in Azure SQL Database (Part I)”

The “strange” case of high I/O usage in Azure SQL Database

Hi there!

Recently I was involved in a project that aimed for the downsizing of the Pricing tiers in some Azure SQL Databases, in order to get a more cost effective solution. I’m going to tell a (true) story about a situation that happened with one of them, regarding a strange I/O usage up to 100% every now and then, with no apparent reason, after the downsizing took place. I’m also going to explain how I fixed it while keeping the database in the same tier, hence achieving a more cost effective solution with no impact in performance.

Continue reading “The “strange” case of high I/O usage in Azure SQL Database”

The “computed column”, the “scalar function” and the “non parallel plan”… Oops!

Hi there!

Just like in the movie “The Good, the Bad and the Ugly” there are also 3 main actors here.
In this post, I’m going to invite you to meet a scenario that can result in a significant performance issue, learn how to look for it, verify the consequences of its use and ways to solve it!

If you like performance tuning, just keep on reading ๐Ÿ™‚

Continue reading “The “computed column”, the “scalar function” and the “non parallel plan”… Oops!”

Create your own website, free on WordPress.com.Create your own website.
Start free