Sqlcomics

SQL Corgs Explain Inner Joins

Kendra Little on April 15, 2024

Joins are essential. The SQL Corgs introduce you to INNER joins in this animated short. When you need to combine data from multiple tables, INNER joins are your go-to tool: they only return rows where there’s a match in both tables.

Watch as Freyja and Stormy demonstrate how matching on color brings their favorite toys together, with sample code you can run yourself.

Take Me There

SQL Corgs Explain Inner Joins

Awkward Unicorn Explains Database Normalization

Kendra Little on April 3, 2024

Why do we “normalize” relational databases, and what are the basics? Awkward Unicorn explains, with a little help from their friends.

Database normalization helps you organize data efficiently, reduce redundancy, and prevent update anomalies. It’s one of those foundational concepts that makes everything else in database design make more sense.

Take Me There

Awkward Unicorn Explains Database Normalization

SQL Basics (SELECT, FROM, WHERE) with Freyja the Corgi

Kendra Little on April 1, 2024

Freyja the corgi shares her tips for learning SQL: SELECT, FROM, and WHERE. These three keywords form the foundation of almost every query you’ll write. SELECT tells you what columns to return, FROM specifies which table to query, and WHERE filters the rows.

Once you’ve got these down, you’re well on your way to writing effective SQL queries. Now that I’m getting the hang of this, I think I’m going to do a whole series of shorts on SQL syntax essentials, plus tips and tricks!

Take Me There

SQL Basics (SELECT, FROM, WHERE) with Freyja the Corgi

Rita the Raccoon Writes SQL

Kendra Little on March 28, 2024

I learned to make short form videos with my drawings this week, and, well… things are about to get weirder. Meet Rita the Raccoon, who’s here to help explain SQL concepts in a way that’s both educational and delightfully unexpected.

This is the first in what I hope will be a fun series of animated SQL tutorials featuring my favorite characters.

Take Me There

Rita the Raccoon Writes SQL

Nested Loops

Kendra Little on March 24, 2024

Nested loop join operators tend to look quite innocent in an estimated query execution plan. But life ain’t always so simple. These operators can be fast when working with small datasets, but they can also cause serious performance problems when plans get reused inappropriately or when they’re not optimized.

Understanding when nested loops work well (and when they don’t) is key to troubleshooting slow queries.

Take Me There

Nested Loops

Meet the SQL Server Query Optimizer

Kendra Little on March 11, 2024

Meet the SQL Server Query Optimizer, the brain behind every query execution plan. This clever optimizer analyzes your queries and decides the best way to execute them, choosing join operators, index usage, and execution strategies.

Thanks to Erik Darling for pointing out that it needed a little teeth.

Take Me There

Meet the SQL Server Query Optimizer

Plan Caching in SQL Server v1

Kendra Little on March 4, 2024

I drew out a first visualization of how the shared plan cache in SQL Server is used when you run a query. When SQL Server executes a query, it creates an execution plan and stores it in the plan cache for reuse. This caching mechanism helps performance by avoiding the overhead of recompiling similar queries, but it can also lead to plan reuse problems when the cached plan isn’t optimal for new parameter values.

I’m pretty sure I’ll refine and and elaborate on this in the future, so let’s call this the v1.

Take Me There

Plan Caching in SQL Server v1

Compare SQL Server Isolation levels

Kendra Little on February 17, 2024

Most modern hardware supports RCSI and Snapshot isolation beautifully. These isolation levels help your database scale by allowing readers and writers to work concurrently without blocking each other unnecessarily.

Read Committed Snapshot Isolation (RCSI) provides statement-level consistency, while Snapshot Isolation extends that to transaction-level consistency. Both are excellent choices for modern workloads where you need high concurrency without sacrificing data correctness.

Take Me There

Compare SQL Server Isolation levels

Indexed Views Koala

Kendra Little on January 17, 2024

Indexed views are amazing: they’re like an auto-updating table based on the definition of the view. Whenever rows change in the tables defined in the view, those changes are also applied to the indexed view. This makes them perfect for pre-aggregating data or creating materialized views that stay in sync automatically.

However, that automatic updating comes with a cost: modifications to the underlying tables can become slower because the indexed view must be updated as part of the same transaction.

Take Me There

Indexed Views Koala

Exploring optimized locking

Kendra Little on December 17, 2023

SQL Server has a new feature that’s currently only available in Azure SQL Database: Optimized Locking. This capability reduces lock contention by optimizing how locks are acquired and released, potentially improving concurrency for workloads with many concurrent transactions.

It’s a very interesting capability that looks like it could potentially be a great fit for all sorts of SQL Server implementations in the future.

Take Me There

Exploring optimized locking