Re: Query causing explosion of temp space with join involving partitioning

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Krzysztof Nienartowicz <Krzysztof(dot)Nienartowicz(at)unige(dot)ch>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: Re: Query causing explosion of temp space with join involving partitioning
Date: 2010-05-27 16:41:28
Message-ID: 3578.1274978488@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-performance

Krzysztof Nienartowicz <Krzysztof(dot)Nienartowicz(at)unige(dot)ch> writes:
> Logs of the system running queries are not utterly clear, so chasing the
> parameters for the explosive query is not that simple (shared logs between
> multiple threads), but from what I see there is no difference between them
> and the plan looks like (without removal of irrelevant parameters this time,
> most of them are float8, but also bytea)
> [ nestloop with inner index scans over the inherited table ]

Well, that type of plan isn't going to consume much memory or disk
space. What I suspect is happening is that sometimes, depending on the
specific parameter values called out in the query, the planner is
switching to another plan type that does consume lots of space (probably
via sort or hash temp files). The most obvious guess is that that will
happen when the range limits on srcid get far enough apart to make a
nestloop not look cheap. You could try experimenting with EXPLAIN and
different constant values to see what you get.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thom Brown 2010-05-27 21:41:02 PostgreSQL 9.0b1 - Error when checking table sizes
Previous Message Tom Lane 2010-05-27 13:50:08 Re: Cache lookup failure for index during pg_dump

Browse pgsql-performance by date

  From Date Subject
Next Message Cédric Villemain 2010-05-27 18:22:10 Re: shared_buffers advice
Previous Message alvherre 2010-05-27 16:10:20 Re: Autovacuum in postgres.