Lesson 3.3

Tuning a slow query

Rewriting is often better than indexing. Remove the function on the indexed column, cut the rows early, and check the plan again.

Duration
8m
Level
Intermediate
Students
7k students

Overview

Rewriting is often better than indexing. Remove the function on the indexed column, cut the rows early, and check the plan again.

In this lesson you will:

  • Rewrite predicates so an index can be used
  • Reduce the row count as early as possible
  • Verify the improvement with a fresh plan

Resources

PostgreSQL documentation

The official reference for the tools used in this lesson.