• Fundamentals & Training
    • Enroll Now in Everything
    • Fundamentals of Select
    • Fundamentals of Index Tuning
    • Fundamentals of Vacuum
    • Fundamentals of Python
    • Download the Stack Overflow Sample Database for Postgres
  • Blog
    • Newsletter Archives
    • Query Exercises
    • Query Exercise Answers
  • About
  • Contact
Enroll Now

Query Exercise: Find Sister Locations to Help Each Other

February 29, 2024
For this week’s Query Exercise, let’s start by taking a look at the Users table to see what we’re dealing with: PgSQL select u.location, count(*) as population, avg(u.reputation) as AvgReputation…
Learn more

Finding Long Values Faster: Answers & Discussion

February 28, 2024
Our challenge from last week was that the developers were complaining about a slow query in the Stack Overflow database that wasn’t as fast as they’d like. PgSQL select *…
Learn more

Smart Postgres News and Techniques 2024 Vol 7

February 27, 2024
The best single-page guide to query tuning that I’ve ever seen, for any database platform, dropped this week from Francesco Tisiot of EverSQL.  It’s one hell of a long page,…
Learn more

Query Exercise: Finding Long Values Faster

February 22, 2024
Our developers have come to us with a problem query in the Stack Overflow database that isn’t as fast as they’d like. PgSQL select * from users where length(displayname) >…
Learn more

Smart Postgres News and Techniques 2024 Vol 6

February 21, 2024
If your Postgres database gets queried by multiple app servers, you’re probably going to want a connection pooler. Michael Aboagye explains what that is and why you want one. When…
Learn more

Smart Postgres News and Techniques 2024 Vol 5

February 15, 2024
When you have a slow query, and you want to see which parts of the plan took the longest or had the least accurate estimates, try pasting the plan into…
Learn more

Improving Cardinality Estimation: Answers & Discussion

February 14, 2024
Your challenge for this week was to improve estimation on a query. Stack Overflow has a dashboard that shows the top-ranking users in their most popular location. The Stack Overflow…
Learn more

Query Exercise: Improving Cardinality Estimation

February 8, 2024
Your challenge for this week is to tune a query. Say Stack Overflow has a dashboard that shows the top-ranking users in their most popular location. The Stack Overflow database…
Learn more

Finding Tagged Questions Faster: Answers & Discussion

January 31, 2024
Your query exercise was to take this Stack Overflow query to find the top-voted questions for any given tag: PgSQL select * from posts where tags like '%<postgresql>%' order by…
Learn more

SQLAI.ai Review: Using AI to Generate & Tune Queries

January 30, 2024
SQLAI.ai‘s tagline is that you can hook your database up to ChatGPT, and let it generate, explain and optimize queries. To see how it works, I hooked it up to…
Learn more
Previous 1 2 3 4 5 6 7 Next

© Smart Postgres, Inc. All rights reserved. For questions, email humans@smartpostgres.com.