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

Detecting Issues

This editorial was originally published on Mar 1, 2017. It is being re-run as Steve is away for the company wellbeing day.

Here's a simple question: how are more of your application issues detected, by people or systems? I bet most of you initially think of your monitoring systems and the automated messages or pages that are sent out regularly as detecting most, or even all, of your problems. Have you stopped to think how many times a phone call lets you know about an issue? Do you consider the ways in which a code review or human tester brings up a concern?

I try to think about all software problems, both the ones that reach production and the ones that are prevented early. If I catch a SELECT * in a view during development, I can prevent a problem months later when a table adds a column and no one refreshes the view in production. Those potential issues that never get to the customer are wins for me, and I think this is something we should be proud of as software engineers and testers.

Can you move the numbers, though? Is there a way to find problems before people find them? I think there is, and it's with better monitoring and better testing. For monitoring, we need better, and more, instrumentation that measures what we expect, looks for deviations, and (low level) alerts someone. This is an area where I think machine learning and better analysis will help. Those ML models can be hard to setup, so I'm hoping that some individuals or projects will start some work here. Microsoft is doing some of this in Azure, and I hope they share some knowledge with us.

Testing is really the way to catch more issues before humans do. We've known this for decades in software development, but so many developers have been resistant to the idea of building some sort of formal test for their code. It's not fun, it's hard to maintain, and really, it's just hard for most people to start writing tests.

I think things are getting better with testing frameworks that make building and executing tests easier. We have frameworks for all major application languages, and even quite a few for T-SQL. We've also learned more about the types of tests to write, which type to ignore, and how to avoid building so many brittle tests that testing is more work than coding features. If you know nothing about testing, you owe it to yourself to spend a little time learning about unit testing and practicing writing tests.

Now that we are collecting more and more data about our applications, we have the opportunity to really build software that better meets the goals and needs of our customers. However, we have to take advantage of this data, and the advances in testing, to ensure that we build the best software we can.

Steve Jones - SSC Editor

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

 
 Featured Contents
SQLServerCentral Article

Guarding Against SQL Injection at the Database Layer (SQL Server)

tedo from SQLServerCentral

This article presents a way to check and validate input before using it in your dynamic SQL queries to prevent SQL Injection problems.

External Article

Python is good, but not perfect – here are 10 reasons to avoid it

Additional Articles from SimpleTalk

Four years ago I wrote a blog on this site explaining why Python is better than C# and, arguably, most other programming languages. To redress the balance, here are 10 reasons why you might want to avoid getting caught up in Python’s oh-so-tempting coils – particularly when building large, long-lived systems.

Blog Post

From the SQL Server Central Blogs - RANK() vs DENSE_RANK(): #SQLNewBlogger

Steve Jones - SSC Editor from The Voice of the DBA

I haven’t done one of these in awhile, but I saw an article recently about this and decided to explain it to myself, but in a slightly different way....

SQL Server 2025 Query Performance Tuning: Troubleshoot and Optimize Query Performance

Site Owners from SQLServerCentral

A new era of SQL Server is here, and this latest edition of Grant Fritchey’s best-selling dive into SQL Server query performance can ensure your queries keep up.

 

 Question of the Day

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

 

A Quick Restore

While doing some testing of an application, I wanted to reset my environment after doing some testing with this code:
USE DNRTest

BACKUP DATABASE DNRTest TO DISK = 'dnrtest.bak'
GO
/*
Bunch of stuff tested here
*/RESTORE DATABASE DNRTest FROM DISK = 'dnrtest.bak' WITH REPLACE
What happens if this runs, assuming the "bunch of stuff" isn't anything affecting the instance.

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)

String Similarity I

On SQL Server 2025, when I run this, what is returned?

SELECT EDIT_DISTANCE_SIMILARITY('SQL Server', 'MySQL')

Answer: 10, 40

Explanation: This function uses the EDIT_DISTANCE() function and then compares this to the lengths of the strings with this formula: (1 – (edit_distance / greatest(len(string1), len(string2)))) * 100 The distance for these strings is 6 and the longest string is 10. From 1, we get .4, which becomes 40. Ref: EDIT_DISTANCE_SIMILARITY - https://learn.microsoft.com/en-us/sql/t-sql/functions/edit-distance-similarity-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.


SQL Server 2019 - Development
Which 'Where' statement conditional upon a variable - Thanks in advance for any clues on this. I am trying to write a 'conditional where' statement in a typical select statement. Early in the stored procedure the variable @Type is set to either 'AB or 'CD'. I'm trying to have my WHERE be dependent on that variable e.g.: WHEN @Type = 'AB' my "WHERE" […]
Integration Services
Foreach Loop still executes after process and delete all the folders - I have two challenges XML source control not displaying the XML file parent node columns even though it is showing in the XSD file. Is there any solution to get the XML parent nodes columns in the XML source component. Foreach loop container control not stopping. it still executes if more than two files in […]
Editorials
Can You Let Go of Determinism - Comments posted to this topic are about the item Can You Let Go of Determinism
Doing Good at SQL Server Central - Comments posted to this topic are about the item Doing Good at SQL Server Central
Engineer Lessons - Comments posted to this topic are about the item Engineer Lessons
Article Discussions by Author
Lots of FKs - Comments posted to this topic are about the item Lots of FKs
Real-time On-prem SQL Server Data in Excel – Over the Internet - Comments posted to this topic are about the item Real-time On-prem SQL Server Data in Excel – Over the Internet
Missing the Jaro Winkler Distance - Comments posted to this topic are about the item Missing the Jaro Winkler Distance
25 Years Later: What SQLServerCentral Meant to Me - Comments posted to this topic are about the item 25 Years Later: What SQLServerCentral Meant to Me
Fun with JSON - Comments posted to this topic are about the item Fun with JSON
Creating JSON II - Comments posted to this topic are about the item Creating JSON II
Backup to Immutable Storage - Comments posted to this topic are about the item Backup to Immutable Storage
SQL Server 2022 - Development
AllocationType as ROW_OVERFLOW_DATA - Hello, I inherited a number of tables with like 20-30 column using nvarchar(256) in each of the tables, when, in fact, the values stored in those tables are way less than 256. So the Actual Size of each row in those tables is way less then 500, but when I run below queries for my […]
connections vs apis - hi , i hear more and more that we have too many connections to our servers.    many are sql.   many arent. so we are told to use api's where possible. Isnt there a connection behind the scenes when an api is asked to return data from whatever the erp's database is>
is it true we cant debug c# scripts in ssis anymore under vs - Hi, i'm running vs2022.   I'm trying out a c# script that i'd like to set breakpoints on to trap the exception that gets thrown when i debug.  From what i'm reading, i cant debug it because my runtime bitness is 64 and that setting cant be changed (it is greyed for me) in vs2022. is […]
 

 

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

 

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