Launch week: the Season Pass & Fundamentals Week are 50% off — ends in 10d 01h 37mSee the sale

Category: SQL Server

Should You Use SQL Server 2022’s GREATEST and LEAST?

If you've been following along with this week's posts on DATETRUNC and STRING_SPLIT, you're probably going to think the answer is no, but bear with me. It's Christmas week, right? The news can't all be bad.

GREATEST and LEAST are kinda like MAX and MIN, but instead of taking multiple rows as input, they take multiple columns. For example:
[crayon-6a44415b5489c138057175/]
Produces 3 and 1. This actually has really useful real-world implications.

Read more about Should You Use SQL Server 2022’s GREATEST and LEAST? 2 comments — Join the discussion

SQL Server 2022 Release Date: November 16, 2022

Microsoft released SQL Server 2022 today, November 16, 2022.

The footnotes indicate:
SQL Server 2022 free editions (Developer edition, Express edition) are available to download starting today. SQL Server 2022 paid editions (Enterprise edition, Standard edition) will be available in Volume Licensing (Enterprise Agreement, Enterprise Agreement Subscriptions) customers starting today, which represents the majority of SQL Server customers. Customers purchasing via CSP, OEM, and SPLA can begin purchasing SQL Server 2022 in January 2023.
Learn more about what's new in SQL Server 2022.

Read more about SQL Server 2022 Release Date: November 16, 2022 7 comments — Join the discussion

Office Hours: Read This, Watch This Edition

This week, a lot of the questions you posted at https://pollgab.com/room/brento just need pointers to resources at other places. Welcome to the Read This, Watch This series of answers.

Don't Blame Anthony: Our developers prefer writing TSQL queries directly in their .NET code rather than writing sprocs and calling them. What are the pros / cons to this approach?

Read more about Office Hours: Read This, Watch This Edition 1 comment — Join the discussion

Free Live Webcast: Why is One Query Sometimes Slow and Sometimes Fast?

Sometimes the exact same query goes slow out of nowhere. Your current fix is to update statistics, rebuild indexes, or restart the SQL Server. It works, but you don’t know why.

The single most common reason is parameter sniffing. SQL Server "sniffs" the first set of parameters for a query, builds an execution plan for it, and then reuses that same plan no matter what parameters get called. It’s been the bane of our performance tuning for decades.

Read more about Free Live Webcast: Why is One Query Sometimes Slow and Sometimes Fast? 2 comments — Join the discussion
Performance Tuning

PSPO: How SQL Server 2022 Tries to Fix Parameter Sniffing

Parameter sniffing is a notorious problem for Microsoft SQL Server because it tries to reuse execution plans, which doesn't work out well for widely varying parameters. Here's a primer for the basics about how it happens. SQL Server 2022 introduces a new feature called Parameter Sensitive Plan optimization. I'm not really sure why Microsoft capitalized…

Read more about PSPO: How SQL Server 2022 Tries to Fix Parameter Sniffing 38 comments — Join the discussion

What’s New in SQL Server 2022 Release Candidate 0: Undocumented Stuff

Microsoft has an official list of what's new in 2022 overall, but here I'm specifically focusing on system objects that might be interesting to script developers like you and I, dear reader. New stored procedure sp_get_table_card_est_and_avg_col_len - I assume the "card" refers to statistics and cardinality, not Hallmark. SQL Server has historically struggled with memory…

Read more about What’s New in SQL Server 2022 Release Candidate 0: Undocumented Stuff 24 comments — Join the discussion

Pour One Out for Distributed Replay. It’s Deprecated in SQL Server 2022.

I love how Microsoft treats deprecated and discontinued features in SQL Server.

No, seriously. I give Microsoft a lot of sarcasm and lip around here, but Microsoft takes serious care to make it easy to upgrade versions without worrying about your application breaking. If you disagree, hear me out for a minute.
"Discontinued" means it's dead and removed.
The Books Online page for discontinued database engine functionality is pretty doggone short. There have only been a few things deprecated in the last several years:

Read more about Pour One Out for Distributed Replay. It’s Deprecated in SQL Server 2022. 12 comments — Join the discussion
Performance Tuning

SQL Server 2022 Tells You Why A Query Can’t Go Parallel.

Until 2022, when a query couldn't go parallel, all we got was a really cryptic note in the execution plan properties saying NonParallelPlanReason = CouldNotGenerateValidParallelPlan.

But starting with SQL Server 2022, even when I'm running under older compatibility levels:
[crayon-6a44415b616a3679536412/]
The execution plan gives me way more details:

Read more about SQL Server 2022 Tells You Why A Query Can’t Go Parallel. 10 comments — Join the discussion

The SQL Server Posts You Read the Most in 2021

I think of my blog posts in a few different categories:

Posts that will only be read at the moment they're published (like upcoming webcasts, humorous stuff, and career advice)
Posts that will show up in search history over time and continue to be evergreen (like how a feature works)
Posts that provoke discussion and interactivity (like asking you a question or running a contest)

Read more about The SQL Server Posts You Read the Most in 2021 Be the first to comment