This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
Gouache painting of a white cloth covering an unseen lump beside a small wooden box fitted around a pear

Parameter Sniffing Local Variable: What the Trick Fixes

December 20, 2019
Pinal Dave
SQL Tips and Tricks
Parameter Sniffing, SQL Scripts, SQL Statistics, SQL Stored Procedure

The parameter sniffing local variable trick copies a parameter into a variable so SQL Server cannot sniff it. This post measures the estimate and the page reads of a sniffed and a local variable procedure, called in both orders. It shows what the trick fixes, and what it leaves slow.

Read More
Illustrated cover: Parameter Sniffing

SQL SERVER – Parameter Sniffing Simplest Example

December 19, 2019
Pinal Dave
SQL Tips and Tricks
Execution Plan, Parameter Sniffing, SQL Scripts, SQL Server, SQL Stored Procedure

Today we will see a very simple example of the Parameter Sniffing. Let us see a very simple example of the parameter sniffing.

Read More
Gouache painting of a row of cream parcels each with a small brass bell on top, one parcel wrapped in vermilion

NOCOUNT Performance: What SET NOCOUNT ON Saves in a Loop

December 18, 2019
Pinal Dave
SQL Performance
SQL Cursor, SQL Scripts, SQL Server, SQL Stored Procedure

NOCOUNT performance depends on the messages that SQL Server no longer sends to the client. This post counts the network packets of a procedure with a 5,000 step loop, with the setting off and on. It also explains why some tests show no time gain, and where the setting helps most.

Read More
Gouache painting of a tangled old thread spool beside a fresh vermilion spool on a sewing table

Procedure Recompilation: Force a New Plan in SQL Server

November 22, 2019
Pinal Dave
SQL Tips and Tricks
Execution Plan, SQL Scripts, SQL Stored Procedure

Procedure recompilation builds a new plan without changing the procedure. A tested demo compares EXEC with WITH RECOMPILE and sp_recompile on a skewed table, with 100,089 reads on a stale plan and 348 on a fresh one. It also shows that sp_recompile removes every cached plan of the procedure.

Read More
A signalman's hand passing a brass single-line token in a hoop to a train driver's gloved hand.

Application Locks With sp_getapplock: One Job at a Time

November 15, 2019
Pinal Dave
SQL Tips and Tricks
SQL Lock, SQL Server, SQL Server Agent, SQL Stored Procedure, SQL Transactions

Use sp_getapplock to serialize a job, compare transaction and session ownership, handle return codes, and inspect a two-session test.

Read More
A short bridge lets a marble bypass a longer winding wooden track

How to Use GOTO command in SQL Server? – Interview Question of the Week #249

November 3, 2019
Pinal Dave
SQL Interview Questions and Answers
SQL Scripts, SQL Server, SQL Stored Procedure

Question: How to Use GOTO command in SQL Server?

Answer: Let us see a simple example of how GOTO works in SQL Server in this blog post.

Read More
Gouache painting of a hedge maze with a long winding path and a quick exit through a vermilion arch

RETURN Statement in a Stored Procedure: Exit Early

November 2, 2019
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL Stored Procedure, SQL Transactions

The RETURN statement ends a stored procedure at once and hands back one integer status code. This post builds a small demo, shows how to read the code, stops a procedure after a chosen step, and tests what RETURN does with NULL, text, open transactions and errors.

Read More
Previous 1 … 4 5 6 7 8 9 10 … 36 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com