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.
8mIntermediate6,975 students

Sign in to watch this lesson
Browsing is free. Create an account to play videos and track your progress.
Overview
Rewriting is often better than indexing. Remove the function on the indexed column, cut the rows early, and check the plan again.
What this lesson covers
- Rewrite predicates so an index can be used
- Reduce the row count as early as possible
- Verify the improvement with a fresh plan
This lesson sits in Query Performance, part of PostgreSQL for Developers. It assumes what came before it and leads directly into the next lesson in the module.
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
Pro Tip
Wrapping an indexed column in a function usually disables the index. Transform the parameter instead.