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 1DBFFD1B3C7 for ; Wed, 26 May 2004 13:51:15 -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 54471-10 for ; Wed, 26 May 2004 13:50:55 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 8C66ED1B1D1 for ; Wed, 26 May 2004 13:50:53 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4QGorT1083091 for ; Wed, 26 May 2004 16:50:53 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4QGU41d041759 for pgsql-sql@postgresql.org; Wed, 26 May 2004 16:30:04 GMT From: Gaetano Mendola X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Memory usage on subselect Date: Wed, 26 May 2004 18:29:42 +0200 Organization: PYRENET Midi-pyrenees Provider Lines: 39 Message-ID: <40B4C5F6.3010700@bigfoot.com> 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> <9ADF76EC-AF2C-11D8-9250-000A958E367A@llgc.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr To: Dan Field User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en In-Reply-To: <9ADF76EC-AF2C-11D8-9250-000A958E367A@llgc.org.uk> To: pgsql-sql@postgresql.org 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/212 X-Sequence-Number: 17926 Dan Field wrote: > > 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. You have to use the pg_autovacuum demon. Run the vacuum full and the reindex once in a week. Regards Gaetano Mendola