Yesterday I was looking at the query that took around 25 seconds to execute on our prod read replica. I ran explain anaylyze to see what can be the issue and what can be done immediately as this is something that constantly timeouts on a production. Here’s the part of the explain graph that I was looking at the most:

Explain that shows what is the problem

From this graph I could imagine that the biggest problem here is the gather merge, then hash join. But no immediate actions could be done to those, at least as far as I can understand. I figure, I’d at least fix the sorting, even though it’s not super important.

An important special case is ORDER BY in combination with LIMIT n: an explicit sort will have to process all the data to identify th…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help