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
Small snorkeling fin casting an enlarged shadow on a cream wall

ROWCOUNT and PAGECOUNT: Faking a Big Table to Test Plans

September 6, 2017
Pinal Dave
SQL Tips and Tricks
SQL System Table, SQL Table Operation, Table Partitioning, Temp Table

You can tell the optimizer a three-row table has 10 million rows and watch the plan change. Here is how, and how to undo it.

Read More
Clay ocarina openings beside their distinct matching plugs

Magic Numbers in Code: Replacing Status Codes With a Lookup Table

June 20, 2017
Pinal Dave
SQL Tips and Tricks
SQL System Table, SQL Table Operation, Table Partitioning, Temp Table

Nobody remembers what the 3 means. Give each status code an approved name, let the database enforce it, and leave your data alone.

Read More
Current peony bloom beside retained fallen petal layers

Temporal History Queries: Indexing the History Table for Speed

March 1, 2017
Pinal Dave
SQL Performance
SQL System Table, SQL Table Operation, Table Partitioning, Temp Table

Your current table is tiny, but the AS OF question hides in the history table. See the reads before and after a key-first index, and what it costs.

Read More
Incense censer retaining earlier ash beside an older fragment and a fresh coil

Currency Rates by Effective Date: Designing the Lookup Table

January 21, 2017
Pinal Dave
SQL Tips and Tricks
SQL System Table, SQL Table Operation, Table Partitioning, Temp Table

Why did last quarter’s invoices change overnight? Probably because the rate table had no dates. Here is a lookup that remembers.

Read More
Magnolia branch showing connected buds and a detached twig below

Building Full Folder Paths From a Parent-Child Table

November 2, 2016
Pinal Dave
SQL Tips and Tricks
SQL System Table, SQL Table Operation, Table Partitioning, Temp Table

Your folder table stores only a name and a parent, so the full path has to be walked. I show the query, and how to catch the rows it quietly leaves out.

Read More
Two bobbins fitting different matching thread spindles

Changing a User-Defined Table Type That Procedures Use

June 10, 2016
Pinal Dave
SQL Tips and Tricks
SQL Table Operation, SQL User Group, Table Partitioning, Temp Table

You need one more column in a table type, but procedures depend on it. Here is the order of moves that works, with the errors along the way.

Read More
Rubber curry comb with hairs in some spaces and empty spaces retained

Counting Partitions per Table and Spotting Empty Ones

May 20, 2016
Pinal Dave
SQL Tips and Tricks
SQL System Table, SQL Table Operation, Table Partitioning, Temp Table

A quick count said 8 partitions, but the table has 4. Here is where the extra rows came from and how to spot empty partitions.

Read More
Previous 1 2 3 4 5 Next
  • Books
  • Testimonials
  • Privacy Policy

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