Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
 
The Voice of the DBA
 

Fixing P1 Queries

When we look at the performance of software, we use Pnn notation to indicate the latency of an issue. A P95 problem is one that exceeds the time that 95% of the other queries take. In other words, this is the 5% slowest things happening, which can include database slowdowns that impact your application.

For many years in software development, we have tended to work on the P95 or P90 issues, the slowest items. This is primarily because those can make a big difference to the system's performance. If I fix the slowest things, then the system feels faster. Certainly, I know lots of DBAs and developers will apply this logic to database queries. They focus on the slowest queries and tune them to improve the system. If most things are quicker, especially the things most users notice, then the system feels faster.

We've often limited our work on latent items because the time involved in working on other issues is hard. If you choose to work on items in the P70 range (30% slowest) or the P50 items, does that make sense? There are slower items, so doesn't it make sense to focus on those P95 or P99 items when trying to increase the speed of the user experience? In software, I think this does make sense.

However, in the database world, we aren't often thinking of one user's experience. We're thinking about the volume of requests from all clients. We might find there are queries that seem fast, say 400ms queries, but if these are running thousands of times a minute, we might see more benefit from clients if we reduce this to 200ms than if we speed up a 30s query to 2s. For the database world, we often think about the rate of items, not just their latency (or speed).

For database queries, how do we choose what to focus on if it's not the slowest queries? we might not also want to tackle the most frequent queries either. My question might be: do we need to choose?

In the age of AI, especially if tokens aren't too expensive, do we need to spend engineering time deciding? Would it make sense to let our AI coding agent evaluate and propose changes to all the queries? With a team of agents, we might have time to investigate the entire workload and try to speed everything up. This does mean we need a good system for guiding agents, separating out work, and ensuring that each agent isn't trying to add an index for every query. That's something humans have done, and agents likely will try if they don't have to coordinate their work.

The code of this work isn't zero, and I'd bet there will be a significant amount of time to get this set up in some organizations, though I'd hope as people discover ways to organize agents for database work, with controls to scope their efforts and validation techniques, this becomes easier and easier. I'd like to think that at some point, DBAs will work in the same way software developers are hoping they work: thinking about problems, evaluating potential solutions, and managing AI helpers who type the actual code.

Steve Jones - SSC Editor

Join the debate, and respond to today's editorial on the forums

 
 
 Featured Contents
SQLServerCentral Article

Why SQL Server Database Attach fails and how to repair it

Nisarg Upadhyay from SQLServerCentral

This article covers a few common errors when attaching database files to an instance, with some information on how to resolve the issues.

Technical Article

Big data: what it is, why projects fail, and how to get value from it

Additional Articles from SQLServerCentral

Although ‘Big Data’ (and more specifically, the analysis of it) offers several benefits, organizations often fail to derive the correct insights – the data that could help them make better business decisions. So, in this article, I’ll reveal exactly how organizations can take full advantage of these large datasets to make those better business decisions and improve operational effectiveness.

Blog Post

From the SQL Server Central Blogs - Think Twice Before Enabling Fabric’s Inbound Network Protection

Meagan Longoria from Data Savvy

Fabric inbound network protection involves two tenant-level controls: Private Link and Block Public Internet Access. But enabling them disables several features.
The post Think Twice Before Enabling Fabric’s Inbound Network...

Blog Post

From the SQL Server Central Blogs - Advice I Like: Responsibility

Steve Jones - SSC Editor from The Voice of the DBA

“The foundation of maturity: Just because it’s not your fault doesn’t mean it’s not your responsibility.” – from Excellent Advice for Living I’ve worked with a lot of people...

Technical Article

Databricks Data Intelligence Platform: Unlocking the GenAI Revolution

Site Owners from SQLServerCentral

This book is your comprehensive guide to building robust Generative AI solutions using the Databricks Data Intelligence Platform. Databricks is the fastest-growing data platform offering unified analytics and AI capabilities within a single governance framework, enabling organizations to streamline their data processing workflows, from ingestion to visualization. Additionally, Databricks provides features to train a high-quality large language model (LLM), whether you are looking for Retrieval-Augmented Generation (RAG) or fine-tuning.

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

BIT_COUNT() IV

In SQL Server 2025, I run this code:
select bit_count('A')
What is returned?

Think you know the answer? Click here, and find out if you are right.

 

 

 Yesterday's Question of the Day (by Steve Jones - SSC Editor)

Symmetric Key Encryption

If I run this statement in SQL Server 2025, how is the password encrypted?

CREATE SYMMETRIC KEY MySymmetricKey
WITH ALGORITHM = AES_256,
KEY_SOURCE = 'My secret key source passphrase',
IDENTITY_VALUE = 'My secret identity value'
ENCRYPTION BY PASSWORD = 'S&perS#cretP@ssword7';
GO

Answer: It is encrypted by the Triple DES algorithm

Explanation: If a password is used for encryption, then the TRIPLE DES is used, no matter what algorithm is used for the key. Ref: CREATE SYMMETRIC KEY - https://learn.microsoft.com/en-us/sql/t-sql/statements/create-symmetric-key-transact-sql?view=sql-server-ver17

Discuss this question and answer on the forums

 

 

 

Database Pros Who Need Your Help

Here's a few of the new posts today on the forums. To see more, visit the forums.


General
PowerBI Question - Data Sources - I don't see a PowerBI forum, so I'm posting here. I have a need to create a report using one query but multiple SQL Servers. I'm wondering if I could create a CMS registered group and somehow pass the query to all servers in the group at the same time and pull back the results […]
Editorials
Make It Routine - Comments posted to this topic are about the item Make It Routine
AI Observability Challenges in FinOps as a DBA - Comments posted to this topic are about the item AI Observability Challenges in FinOps as a DBA
Another Model, More Data Loss - Comments posted to this topic are about the item Another Model, More Data Loss
What is CPU Usage? - Comments posted to this topic are about the item What is CPU Usage?
Article Discussions by Author
DBCC CHECKDB Limits III - Comments posted to this topic are about the item DBCC CHECKDB Limits III
CROSS APPLY Fundamentals: Part 1 - Comments posted to this topic are about the item CROSS APPLY Fundamentals: Part 1
SQL Agent Job Automated Change Capture Process - Comments posted to this topic are about the item SQL Agent Job Automated Change Capture Process
Finding a Database Master Key - Comments posted to this topic are about the item Finding a Database Master Key
Can You Really Downgrade from Enterprise to Standard and Save Thousands? Here's What Happened - Comments posted to this topic are about the item Can You Really Downgrade from Enterprise to Standard and Save Thousands? Here's What Happened
Limiting Checkpoints - Comments posted to this topic are about the item Limiting Checkpoints
SQL Server Certificates - Comments posted to this topic are about the item SQL Server Certificates
Connect an Azure Function to Azure SQL database Using a Managed Identity - Comments posted to this topic are about the item Connect an Azure Function to Azure SQL database Using a Managed Identity
SQL Server 2022 - Administration
Migration Challenge: Excessive FULLSCAN Statistics Update Duration Blocking SQL - Hello everyone , I am planning to migrate a database from SQL Server 2014 to SQL Server 2019. The migration process includes a double-run, and one of the steps in the timeline is an UPDATE STATISTICS with FULLSCAN. This operation takes more than three days, which makes the cutover impossible because such a delay is […]
SQL 2025 SSMS Nonsense - Yeah, I know this is a 2022 forum, but I don't see a 2025 forum at the moment. I downloaded 2025 Developer Standard edition and 2025 SSMS. I right click my database to import an excel sheet and "Import Data" is greyed out. Did my Google-Fu and found out that SSIS needs to be installed […]
 

 

RSS FeedTwitter

This email has been sent to {email}. To be removed from this list, please click here. If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com. This newsletter was sent to you because you signed up at SQLServerCentral.com.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -