X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3A625D1B16F for ; Wed, 26 May 2004 12:52:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 30544-05 for ; Wed, 26 May 2004 12:51:58 -0300 (ADT) Received: from post.llgc.org.uk (post.llgc.org.uk [193.61.220.51]) by svr1.postgresql.org (Postfix) with ESMTP id AE7B9D1B176 for ; Wed, 26 May 2004 12:51:53 -0300 (ADT) Received: from [193.61.220.62] (helo=[193.61.220.62]) by post.llgc.org.uk with esmtp (Exim 4.20) id 1BT0dw-0006dQ-Aq; Wed, 26 May 2004 16:48:36 +0100 In-Reply-To: <10740.1085405857@sss.pgh.pa.us> References: <20040522175419.GB54296@dyatel.antar.bryansk.ru> <24527.1085329698@sss.pgh.pa.us> <20040523183249.GC54296@dyatel.antar.bryansk.ru> <10740.1085405857@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <9ADF76EC-AF2C-11D8-9250-000A958E367A@llgc.org.uk> Content-Transfer-Encoding: 7bit Cc: pgsql-sql@postgresql.org From: Dan Field Subject: Re: Memory usage on subselect Date: Wed, 26 May 2004 16:51:51 +0100 To: Tom Lane X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/211 X-Sequence-Number: 17925 On 24 May 2004, at 14:37, Tom Lane wrote: > Dan Field writes: >> I have a similar problem with just one of my queries (although it >> isn't >> a sub select): > > You really ought to vacuum and/or analyze occasionally. The EXPLAIN > results show that the planner hasn't got any non-default statistics > for any of these tables. Wow, thanks for that. I'd been pulling my hair out for a couple of days wondering where I was going wrong. I went from 45 second queries down to sub second query lengths after a simple vacuum full analyze. I've now added nightly and monthly cron jobs to do this for me in future. Out of curiosity, why is this deemed a DBA task rather than an automated postgres task? Once again, many thanks. -- Dan Field - Support Programmer: Cymru ar y we cy_GB: http://www.cymruarywe.org en_GB: http://www.walesontheweb.org