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

Barely Reviewed Code

Years ago I was giving a talk on software development and asked the audience how long it takes to review a PR that has 10 lines changed. Answers were in the minutes to tens of minutes range. I then asked how long it takes to review a PR that has 1,000 lines changed. Some people said hours, but a few people said seconds.

I've often taken the latter, pessimistic view. Not because I don't think engineers want to do a good job, but because I know human behavior. Most humans will get bored, lose focus, and end up skimming through a large amount of code. Many (most?) people don't want to spend all that time, after all they have they their own code to write. They'll just approve the PR and assume testing will catch any major issues.

Even if a reviewer wants to do a great job, they likely will still miss things. It's very hard to focus across that much code.

This is a funny visual (from X) about code reviews. It's titled "me reviewing code written by Claude before pushing it to production." Plenty of people are probably laughing, or thinking this is a good reason to not use an AI to write code.

However, I don't think the problem is an AI writing code. If you trust the AI without reviewing things, that's on you. You deserve blame if things fall apart.

The bigger problem is that an AI can write code so quickly and can make so many changes that PRs will tend to be large. These changes will tend to not get human-reviewed with any level of focus or quality control. The problem is volume, not who wrote the code (or the quality). Certainly quality matters, but it's easy to catch changes if you have a small volume of code. Harder if you have a lot.

The more I use AI for spot work, to handle tedious things, to do something like subtly adjust spacing in a UI or focus on adjusting a few things in a data model, the easier it is to judge the focus and quality of the code. Is the change doing the job I need done, and is it doing it well?

Code quality is a problem we've had ever since we started writing code. AI can make the problem worse, not because of poor coding, but because it will write so much code in a PR that you can't review it appropriately.

Steve Jones - SSC Editor

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

 
 Featured Contents
SQLServerCentral Article

Data Modeling with dbt for Visual Code: The Fabric Modern Data Platform

John Miner from SQLServerCentral

Learn more about dbt in this next article on Data Engineering in Fabric.

External Article

Why use a Composite Index in SQL Server

Additional Articles from MSSQLTips.com

SQL queries can take a long time to run, especially on large tables if not properly indexed. Full table scans can be costly operations when all a user wants is to fetch a few rows based on multiple columns and a WHERE filter. How can we properly index our tables to support multi-column queries?

Blog Post

From the SQL Server Central Blogs - Google Moves Up Post-Quantum Cryptography Timeline

K. Brian Kelley from Databases – Infrastructure – Security

In cryptography, the RSA and ECC algorithms which we use primarily for asymmetric cryptography are susceptible to Shor's Algorithm in quantum cryptography. Cracking those algorithms with classical computing is...

Blog Post

From the SQL Server Central Blogs - Announcements from the Microsoft Fabric Community Conference

James Serra from James Serra's Blog

A ton of new features for Microsoft Fabric were announced at the Microsoft Fabric Community Conference (FabCon Atlanta 26) last week (see the FabCon keynote here). There were 8000 attendees! Here...

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):

 

Using OPENJSON

I have some data in a table that looks like this:
BeerID BeerName    brewer               beerdescription
1      Becks       Interbrew            Beck's is a German-style pilsner beer 
2      Fat Tire    New Belgium          Toasty malt, gentle sweetness, flash of fresh hop bitterness.
3      Mac n Jacks Mac & Jack's Brewery This beer erupts with a floral, hoppy taste
4      Alaskan Amber Alaskan Brewing     Alaskan Brewing Amber Ale is an "alt" style beer
8      Kirin       Kirin Brewing         Kirin Ichiban is a Lager-type beer
If I run this, what is returned?
select t1.key
    from openjson((select t.* FROM Beer AS t for json path)) t1

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)

Identity Defaults

What happens when I run this code?

CREATE TABLE dbo.IdentityTest
(
     id int IDENTITY(10) PRIMARY KEY,
     somevalue VARCHAR(20)
)
GO

Answer: I get an error

Explanation: Either both the seed and increment need to be specified for an identity property, or neither. If neither, the default is 1,1. Ref: CREATE TABLE (Identity section) - https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-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
advice as i migrate my winscp based ssis pkg to our prod server - Hi , i installed winscp on my pc, added it to GAC thru vs (i think a developer script) on my pc as well, and added a reference to it while editing a c# script in vs in the pkg i was developing.  It might have been on 2 c# scripts. I just deployed the […]
String_agg not working as needed - I'm trying to get this string_agg to put all the 'comments' into one result field like instead of: 433    2018-11-06 11:08:12.793     Customer called 433     2018-11-06 11:08:12.793     Customer left message This is needed: 433    2018-11-06 11:08:12.793     Customer called, Customer left message Any ideas?: WITH MaxCommentCTE AS ( SELECT DISTINCT client_id […]
query to track time spent on individual tasks in SSIS - Hi everyone I am looking at building a query to determine how much time is being spent on each task in SSIS.  My SSIS package has a few containers and within each container there are tasks.  Once one container finishes processing then the next container gets processed.  I have never done this before so I […]
Editorials
Is Your Time "Free"? - Comments posted to this topic are about the item Is Your Time "Free"?
Doing the Little Things - Comments posted to this topic are about the item Doing the Little Things
Everything is the right question away - Comments posted to this topic are about the item Everything is the right question away
Hidden Heroes - Comments posted to this topic are about the item Hidden Heroes
Article Discussions by Author
Identities and Sequences II - Comments posted to this topic are about the item Identities and Sequences II
Using PostgreSQL as a NoSQL Store and a Search Engine - Comments posted to this topic are about the item Using PostgreSQL as a NoSQL Store and a Search Engine
Seeding a Fabric Warehouse with dbt for Visual Studio Code: The Fabric Modern Data Platform - Comments posted to this topic are about the item Seeding a Fabric Warehouse with dbt for Visual Studio Code: The Fabric Modern Data Platform
Seeding a Fabric Warehouse with dbt for Visual Studio Code: The Fabric Modern Data Platform - Comments posted to this topic are about the item Seeding a Fabric Warehouse with dbt for Visual Studio Code: The Fabric Modern Data Platform
Historical Data Tracking - Comments posted to this topic are about the item Historical Data Tracking
Vectors in SQL Server 2025 - Comments posted to this topic are about the item Vectors in SQL Server 2025
Odd Sequences - Comments posted to this topic are about the item Odd Sequences
SQL Server Transactional Replication from Always On Availability Groups to Azure SQL Database - Comments posted to this topic are about the item SQL Server Transactional Replication from Always On Availability Groups to Azure SQL Database
 

 

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

 

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