Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
PASS Summit 2025 is fast approaching
The Voice of the DBA
 

Start Fixing Your DB with Better Code

This editorial was originally published on November 16, 2017. It is being re-published as Steve is on vacation.

I ran across an interesting article from Gitlab. They host git repositories for companies that develop software, and of course, part of their hosting is tracked in a database. They use PostgreSQL for their data, and were not happy with the performance of their database backing the system. Up front they admit part of the issue is their own coding, which is likely the problem in so many software projects.

Gitlab accepted this, and certainly many database developers or consultants will let management know that the problem causing poor performance is often poorly written code. Jeff Moden constantly explains in his articles how better code can dramatically reduce the load on your SQL Server, yet fixing code is often the one thing few organizations want to focus on. It's easier to buy more hardware, which often just hides the problem for am all-too-short period of time. Or just complain and try to write new features that take the place of old ones.

I'm sure many of you have heard your parents or teachers tell you it takes about as long to do something right as wrong, so do it right the first time. Often taking a shortcut doesn't really save time. I'm not sure that's true with development. Often it's quicker to do it wrong because doing it right takes a little more planning, and perhaps some testing, likely a bit more time to carefully construct code, and certainly more time to learn how to write code better. That last item is the issue, as so many of us learn to write code poorly, without examples that give us good habits from the start.

The best developers have spent lots of time writing code poorly and learning how to improve their work. They know the tips and tricks in their language(s) of choice. That might be better SQL to create efficient queries, better C# to avoid constantly hitting the database, or something else. However, as most of us learn to write code, we don't learn the best way. We learn the ways that are easiest to teach a user concepts, most of which don't scale well.

If you've made the investment to learn about writing better code, then it doesn't take any longer to write good code from the start. If you've made the investment, and if you practice what you've learned. Jeff has lots of great articles on writing better code, as do many of our other authors. Take a few minutes today and learn to build better SQL code. Your database (and users) will thank you.

Steve Jones - SSC Editor

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

Sponsor PASS Summit 2025
 
 Featured Contents
SQLServerCentral Article

Distributed Availability Group Health: T-SQL and Zabbix

Pablo Echeverria from SQLServerCentral

Spotting synchronization disconnects between a primary and a secondary data center in a distributed availability group configuration can be hard, so here are valuable tools to help you with it

External Article

Secure PostgreSQL in Docker: SSL, Certificates & Config Best Practices

Additional Articles from SimpleTalk

Running Postgres in Docker is great for a quick test but what if you want it to behave like a proper, production-style setup with SSL encryption, certificate-based authentication, persistent volumes, and custom configurations? In this article, we’ll find out how

Blog Post

From the SQL Server Central Blogs - The Book of Redgate: We Value Teams

Steve Jones - SSC Editor from The Voice of the DBA

This value is something that I still hear today: our best work is done in teams. On the facing page, there is a short description of what this means....

Blog Post

From the SQL Server Central Blogs - The Mystery of SQL Server 2025’s New Tricks – Scooby Dooing Episode 5

SQLEspresso from SQLEspresso

Every Scooby-Doo mystery starts with a haunted house, a strange villain, and a trail of clues. With SQL Server 2025 now reaching its first Release Candidate (RC0), it feels...

The Phoenix Project

The Phoenix Project

Additional Articles from SQLServerCentral

In this newly updated and expanded edition of the bestselling The Phoenix Project, co-author Gene Kim includes a new afterword and a deeper delve into the Three Ways as described in The DevOps Handbook.

 

 Question of the Day

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

 

DBCC CHECKIDENT

What is returned as a result set when I run this command without a new seed value?

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)

Vector Datatype Dimensions

The new vector datatype in SQL Server 2025 requires a number dimension parameter. What is the maximum number of dimensions supported?

Answer: 1998

Explanation: No idea where the number comes from, but it is 1998. Ref: Vector datatype - https://learn.microsoft.com/en-us/sql/t-sql/data-types/vector-data-type?view=sql-server-ver17&tabs=csharp

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 - Administration
Compatibility levels on database changing them and impacts. - We’re running SQL Server 2019 with database compatibility level 150, and after recent tuning (RAID-10 tempdb with even files and RCSI enabled) performance is stable; however our application vendor is asking us to drop the database’s compatibility level all the way down to 110 (SQL 2012). My concern is that this would disable many 2019 […]
Timeout when expanding the table - Experts, I am hoping to get some help and feedback. I have a server with 5 instances on it. Out of 256 GB, I have allocated 36GB to this instance. This specific instance has been up and running for over a year now without issues. This instance also has 6 DBs. Yesterday I noticed when […]
SQL Server 2019 - Development
Is there a way for SP to know who called it? - Hi everyone I am writing an SP where there is logic inside the SP that depends how the SP was called.  For example, Start of SP ....code.... If SSIS called SP then do A else do B .... code .... End of SP Is there a way for SP to know who asked it to […]
SQLServerCentral.com Announcements
SSC Website Deployment 24 Sept 2025 - We are planning on a fairly big code deployment to set the stage for some upgrades later this year. Hopefully no issues, but as with any software change, please post here or in Website Issues if you see something.
Editorials
Getting More Time from AI - Comments posted to this topic are about the item Getting More Time from AI
All the Costs of Downtime - Comments posted to this topic are about the item All the Costs of Downtime
Planning for tomorrow, today - database migrations - Comments posted to this topic are about the item Planning for tomorrow, today - database migrations
Article Discussions by Author
Changing the Recovery Time - Comments posted to this topic are about the item Changing the Recovery Time
When Page Prefetching Takes a Back Seat – Exploring Trace Flag 652 in SQL Server - Comments posted to this topic are about the item When Page Prefetching Takes a Back Seat – Exploring Trace Flag 652 in SQL Server
Single User SQL Server on Linux - Comments posted to this topic are about the item Single User SQL Server on Linux
How Well Does the MSSQL Extension in VSCode Work? - Comments posted to this topic are about the item How Well Does the MSSQL Extension in VSCode Work?
The Tightly Linked View - Comments posted to this topic are about the item The Tightly Linked View
Build a Test Lab of SQL Server 2025 on Windows Server 2025 using Hyper-V Virtual Machines - Comments posted to this topic are about the item Build a Test Lab of SQL Server 2025 on Windows Server 2025 using Hyper-V Virtual Machines
SQL Server 2022 - Administration
Bottlenecks on SQL Server performance - We have a BI-application that connects to input tables on a SQL Server 2022 Standard edition. This is installed on a Windows Server 2022 in Azure with the size Standard E32s v5, having 32 vCPUs, 256 GB RAM, 32 data disks and 51200 max IOPS. The SQL Server is used for reading, updating and writing […]
SQL Server 2022 - Development
Is there some good routines for updating SQL Server database objects with GitHub - At work we've been getting better at writing what's known as GitHub Actions (workflows, YAML). I've got it deploying applications to websites, etc. It is cool. One thing users would like to have is a means of deploying updates to SQL Server database objects using GitHub Actions. I've thought about this and have come up […]
 

 

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

 

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