Open julianbieber opened 1 year ago
@julianbieber Thanks for reporting this, we are able to reproduce this successfully with the above mentioned code.
Some technical details: it seems to be a general limitation of Postgres. If we look at distribute_qual_to_rels
, it tries to evaluate variable-free pseudoconstant clauses as high as possible in the join tree. So this false
clause ends up in RelOptInfo->joinrestrictinfo
, not baserestrictinfo
, this is why we can't mark the hypertable relation as dummy and instead try to expand all the partitions. Maybe we could add some special handling for such clauses, if this locking problem is a frequent ocurrence.
What type of bug is this?
Unexpected error
What subsystems and features are affected?
Query planner
What happened?
Hi,
We have observed an out of shared memory error for a query that should only access a few chunks according to the time range passed to the query.
The issue only occurs when combining a join with a where clause that is trivially false.
The error seems to occur in the planning stage, as it is also present when explaining the query (not explain analyze).
There is a workaround: Including the time range in the on clause from the join reduces the number of locks being acquired.
We ran into the issue because our ORM generated the "AND false" condition as a replacement for an IN clause on an empty sequence.
TimescaleDB version affected
2.8.0, 2.3.1
PostgreSQL version used
14.5, 13.3
What operating system did you use?
Alpine 11.2.1 x64
What installation method did you use?
Docker
What platform did you run on?
Amazon Web Services (AWS)
Relevant log output and stack trace
How can we reproduce the bug?