Query kills machine. - Mailing list pgsql-performance

From Stef
Subject Query kills machine.
Date
Msg-id 20040824103240.4d909777@svb.ucs.co.za
Whole thread Raw
Responses Re: Query kills machine.  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
List pgsql-performance
Hi all,

I've attached all the query in query.sql

I'm using postgres 7.3.4 on Linux version 2.4.26-custom
( /proc/sys/vm/overcommit_memory  = 0  this time )

free :
             total       used       free     shared    buffers     cached
Mem:       1810212    1767384      42828          0       5604    1663908
-/+ buffers/cache:      97872    1712340
Swap:       505912     131304     374608

After I rebuilt the database, the query was fast (28255.12 msec).
After one night's insertion into the tables that the query select from,
the query all of a sudden uses up all resources , and the kernel
starts swapping, and I haven't seen the query actually finish when
this happens. I did vacuum analyze AND reindex, but that doesn't
help.

I attached the explain analyze of the query before this happens, and
the explain plan from when it actually happens that the query doesn't finish.

The one noticeable difference, was that before, it used merge joins, and
after, it used hash joins.

When the query was slow, I tried to : set enable_hashjoin to off
for this query, and the query finished relatively fast again (316245.16 msec)

I attached the output of that explain analyze as well, as well as the postgres
settings.

Can anyone shed some light on what's happening here. I can't figure it out.

Kind Regards
Stefan

Attachment

pgsql-performance by date:

Previous
From: my ho
Date:
Subject: Re: postgresql performance with multimedia
Next
From: Christopher Kings-Lynne
Date:
Subject: Re: Query kills machine.