-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Running out of space when sorting result of a query #6310
Comments
In the EXPLAIN we can see that it uses external merge sort which uses like 700MB per chunk, that's probably the reason for the fs usage you're observing. I'm not sure why it decided to choose such a plan, maybe you'll be able to nudge it into using hash aggregation with Regardless of the weird plan choice by Postgres, there's also might be a missed optimization on our side. I think
Not sure it will work, also don't forget to enable sort back with |
Disabling the sort does not help, still consuming storage space. |
@akuzm I have tried your query just in case, but I restarted server once I had less than 5 GB of storage space left. |
The
|
Notes to self: I managed to reproduce the exact plan with per-chunk external sorts on a table from tsbench benchmarks:
This is with Here's what we can improve:
|
What type of bug is this?
Other
What subsystems and features are affected?
Compression, Query executor
What happened?
There is no issues when running the SQL query for the compressed table message
Adding
order by
clause makes my system to run out of space (when using2022-09-01
date,2023-06-01
makes my system to run low on space)Once the query fails, the space is reclaimed.
Attaching files with
explain (analyze, buffers)
output for both queriesorder by
clauseorder by
clauseDefinition of the table
TimescaleDB version affected
2.12.2
PostgreSQL version used
15.4
What operating system did you use?
ArchLinux
What installation method did you use?
Source
What platform did you run on?
On prem/Self-hosted
Relevant log output and stack trace
No response
How can we reproduce the bug?
The text was updated successfully, but these errors were encountered: