pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Merlin Moncure <mmoncure@gmail.com>
To: Moritz Onken <onken@houseofdesign.de>
Cc: pgsql-performance@postgresql.org
Subject: Re: Slow query with a lot of data
Date: Thu, 21 Aug 2008 13:08:14 -0400
Message-ID: <b42b73150808211008g43ac1fcer26e5eaa2420ab6ca@mail.gmail.com> (raw)
In-Reply-To: <74E8B5A3-F0E7-4B66-947B-AE7715A55B90@houseofdesign.de>
References: <90AA1B69-4E9C-4710-9D58-F65620DDA022@houseofdesign.de>
	<3663375B-7AC0-43F6-B6EC-D3EE572F3D34@houseofdesign.de>
	<alpine.DEB.1.10.0808191202450.4454@aragorn.flymine.org>
	<24E3FBFF-E0B8-435E-ACE1-652E93FE2213@houseofdesign.de>
	<alpine.DEB.1.10.0808191311540.4454@aragorn.flymine.org>
	<380CD097-4A33-4134-8C13-B9BF34EC6C63@houseofdesign.de>
	<a1ec7d000808201106j4e901d42q3a296ca1d84c2f9c@mail.gmail.com>
	<7DE7116C-4BBC-4776-AEE0-63A2E2DEAF16@houseofdesign.de>
	<a1ec7d000808210739k1af5bee3ha249baff60378413@mail.gmail.com>
	<74E8B5A3-F0E7-4B66-947B-AE7715A55B90@houseofdesign.de>

On Thu, Aug 21, 2008 at 11:07 AM, Moritz Onken <onken@houseofdesign.de> wrote:
>
> Am 21.08.2008 um 16:39 schrieb Scott Carey:
>
>> It looks to me like the work_mem did have an effect.
>>
>> Your earlier queries had a sort followed by group aggregate at the top,
>> and now its a hash-aggregate.  So the query plan DID change.  That is likely
>> where the first 10x performance gain came from.
>
> But it didn't change as I added the sub select.
> Thank you guys very much. The speed is now ok and I hope I can finish tihs
> work soon.
>
> But there is another problem. If I run this query without the limitation of
> the user id, postgres consumes about 150GB of disk space and dies with
>
> ERROR:  could not write block 25305351 of temporary file: No space left on
> device
>
> After that the avaiable disk space is back to normal.
>
> Is this normal? The resulting table (setup1) is not bigger than 1.5 GB.

Maybe the result is too big.  if you explain the query, you should get
an estimate of rows returned.  If this is the case, you need to
rethink your query or do something like a cursor to browse the result.

merlin



view thread (26+ messages)  latest in thread

Message-ID: <b42b73150808211008g43ac1fcer26e5eaa2420ab6ca@mail.gmail.com>
Permalink:  ../b42b73150808211008g43ac1fcer26e5eaa2420ab6ca@mail.gmail.com/
Also on:    postgresql.org/message-id/b42b73150808211008g43ac1fcer26e5eaa2420ab6ca@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: mmoncure@gmail.com, onken@houseofdesign.de
  Subject: Re: Slow query with a lot of data
  In-Reply-To: <b42b73150808211008g43ac1fcer26e5eaa2420ab6ca@mail.gmail.com>
  References: <90AA1B69-4E9C-4710-9D58-F65620DDA022@houseofdesign.de> <3663375B-7AC0-43F6-B6EC-D3EE572F3D34@houseofdesign.de> <alpine.DEB.1.10.0808191202450.4454@aragorn.flymine.org> <24E3FBFF-E0B8-435E-ACE1-652E93FE2213@houseofdesign.de> <alpine.DEB.1.10.0808191311540.4454@aragorn.flymine.org> <380CD097-4A33-4134-8C13-B9BF34EC6C63@houseofdesign.de> <a1ec7d000808201106j4e901d42q3a296ca1d84c2f9c@mail.gmail.com> <7DE7116C-4BBC-4776-AEE0-63A2E2DEAF16@houseofdesign.de> <a1ec7d000808210739k1af5bee3ha249baff60378413@mail.gmail.com> <74E8B5A3-F0E7-4B66-947B-AE7715A55B90@houseofdesign.de> <b42b73150808211008g43ac1fcer26e5eaa2420ab6ca@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox