Re: swap storm created by 8.2.3

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: swap storm created by 8.2.3
Date: 2007-05-25 16:20:38
Message-ID: 46570CD6.2030807@selectacast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton wrote:
> Joseph Shraibman wrote:
>> I'm running:
>>
>> PostgreSQL 8.2.3 on x86_64-unknown-linux-gnu, compiled by GCC gcc
>> (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
>>
>> My memory settings are:
>>
>> work_mem = 64MB
>> shared_buffers = 128MB
>> temp_buffers = 32MB
>>
>> I ran a query that was "SELECT field, count(*) INTO TEMP temptable"
>> and it grew to be 10gig (as reported by top)
>
> What was the real query?

First I selected 90634 rows (3 ints) into the first temp table, then I
did "select intfield1, count(intfield2) FROM realtable rt WHERE rt.id =
temptable.id and other conditions on rt here GROUP BY intfield1". The
size of the second temp table should have been no more than 60000 rows.

> How many rows are we talking about?
>
> > and brought the whole machine
>> to its knees. How do I keep this from happening again?
>
> Set your per-user limits (man ulimit or man bash) to restrict PG's
> overall memory consumption.
>
What happens when PG hits that limit? Will it start using disk space
for TEMP tables then?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Browne 2007-05-25 16:36:20 Re: why postgresql over other RDBMS
Previous Message Alvaro Herrera 2007-05-25 16:00:50 Re: Referencing any field in a trigger