Part 136: Filtered & Partial Indexes
Why index 10,000,000 completed orders when you only ever query pending orders?
1. Syntax
-- Indexes only rows where status is 'pending' (saves 95% disk space!):
CREATE INDEX idx_pending_orders
ON orders (created_at)
WHERE status = 'pending';
Key Takeaways
- Partial indexes dramatically reduce index size and accelerate write speeds.
In Part 137, we learn Reading Execution Plans: EXPLAIN and EXPLAIN ANALYZE!

