TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Debugging the Postgres query planner (2018)

61 pointsby IvanVergilievover 2 years ago

2 comments

hyperman1over 2 years ago
In general I love what RDBMS and postgresql in particular can bring to you, but this is one corner of them that I hate: Planners are too smart for their own good.<p>This is a standard story: A query ran for a long time without issue, and then, one day, some minor shift in your statistics happens, and now you have a major performance issue in your hands, without any real change on prod. No non-productive environment can help you: They don&#x27;t have the same data or they do have the same data but the statistic sampling was slightly different.<p>If it happens, you have to find an incantation that makes the planner comprehend what&#x27;s going wrong. Postgresql has things like the statistic object and in this case the statistic column property, but finding the right incantation can be black magic, and adding indexes&#x2F;statistics&#x2F;... can take hours so trial and error is slow.<p>Dumber databases have an edge here: Their performance is probably lower, but it is predictable.<p>Some RDBMS have mitigations, e.g. Oracle&#x27;s optimizer plan stability allows you to make the plan unchangeable. It&#x27;s a 2-sided knife of course: It won&#x27;t get better if the data has a chance for it, but it won&#x27;t get worse either.
评论 #32849834 未加载
评论 #32849772 未加载
评论 #32858005 未加载
评论 #32852674 未加载
评论 #32850442 未加载
评论 #32852504 未加载
评论 #32851913 未加载
评论 #32852159 未加载
lawrjoneover 2 years ago
Well this is funny: I&#x27;m the author of this post, and pleasantly surprised to see it coming around for a second time!<p>If you like this content, there&#x27;s a bunch more on my blog that you&#x27;ll probably like too:<p><a href="https:&#x2F;&#x2F;blog.lawrencejones.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.lawrencejones.dev&#x2F;</a><p>While I continue to work with Postgres, I&#x27;m enjoying the life of an early start-up where your default is &quot;not much data&quot;, though it does make you unlearn a lot of the habits developed when dealing with multi-terabyte databases!
评论 #32850057 未加载
评论 #32849989 未加载