Check out our free resources, like our Effective Indexing in Postgres eBook and sign up to our newsletter. Notice: We've updated our Privacy Policy, effective April 28, 2023.

EXPLAIN - Insights: Disk Sorts


A Sort node consumes all rows from its child node and produces sorted output. To stay within bounds of work_mem, it may need to “spill” the sort operation to disk. This ensures it can continue, but, writing to disk during query execution can slow things down dramatically.

Recommended Action:

Increase work_mem until the sort can be performed in memory.

Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →