I Tried to Query 10 MILLION Rows in Postgres in 1 Second

Author: Database Star
Published At: 2024-11-12T00:00:00
Length: 14:20

Summary

Description

📝 Get my free SQL Cheat Sheets: https://databasestar.mykajabi.com/lpkj-sql-cheat-sheets/?video=9F4nCjnV43E

🎓 Write faster SQL today: https://databasestar.mykajabi.com/get-write-faster-sql/?video=9F4nCjnV43E

I've got an SQL query that queries a table with more than 10m rows in a table. It runs pretty slowly, and in this video I'll try a range of techniques to get it to run in under 1 second.

⏱ TIMESTAMPS:

00:00 - Our data

01:58 - Our query

04:05 - Add indexes

05:22 - Union All

06:28 - Case

09:17 - Add a column

11:34 - Another index

🔗 VIDEO LINKS:

Scripts shown in this video: https://github.com/bbrumm/databasestar/tree/main/videos/190_10m_postgres

Translated At: 2025-06-29T04:16:39Z

Request translate (One translation is about 5 minutes)

Version 3 (stable)

Optimized for a single speaker. Suitable for knowledge sharing or teaching videos.

Recommended Videos