• 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
Size after updating 25% of rows and vacuuming

Query Exercise Answer: Here’s Why The Index Gets Smaller with Updates.

January 28, 2025
In last week’s Query Exercise, I asked you why updating a table reduced its index sizes. Our table had a date column called last_update_date, and when we set that date…
Learn more

Finding Sister Locations to Help Each Other: Answers & Discussion

March 6, 2024
This week’s query exercise asked you to find two kinds of locations in the Stack Overflow database: Locations populated with users who seem to be really helpful, meaning, they write…
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

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

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

Find the Best Time for Maintenance: Answers & Discussion

January 24, 2024
Your Query Exercise was to find the best time to take the database offline for maintenance – the time when we’ve got the least load. We kept this one pretty…
Learn more

Find Posts with the Wrong CommentCount: Answers & Discussion

January 17, 2024
Your Query Exercise was to find denormalization accuracy problems: checking the accuracy of a reporting column: posts.commentcount. There were two parts: finding the top 100 most problematic posts with the…
Learn more

Find Foreign Key Problems: Answers & Discussion

January 10, 2024
Your Query Exercise was to find foreign key problems: data that might stop us from successfully implementing foreign keys in the Stack Overflow database. Question 1: Write queries to find…
Learn more

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