X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 10CD6D1B545 for ; Thu, 20 Nov 2003 21:06:42 +0000 (GMT) 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 13700-03 for ; Thu, 20 Nov 2003 17:06:12 -0400 (AST) Received: from sunsite.dcc.uchile.cl (sunsite.dcc.uchile.cl [192.80.24.2]) by svr1.postgresql.org (Postfix) with ESMTP id 95728D1D3FB for ; Thu, 20 Nov 2003 17:06:04 -0400 (AST) Received: from alvherre@anakena.dcc.uchile.cl [192.80.24.3] by sunsite.dcc.uchile.cl (8.8.5/Main-DCCV8-Jo6) id SAA04327; Thu, 20 Nov 2003 18:06:02 -0300 (CDT) Received: from alvherre@localhost by anakena.dcc.uchile.cl (8.8.5/MainSec-DCCV8-Jo5) id SAA12077; Thu, 20 Nov 2003 18:06:00 -0300 (CLST) Date: Thu, 20 Nov 2003 18:06:00 -0300 From: Alvaro Herrera Munoz To: Rick Gigger Cc: Mike Mascari , PgSQL General ML Subject: Re: performance problem Message-ID: <20031120210600.GC26865@dcc.uchile.cl> References: <1069164075.986.239.camel@bbking.uio.no> <20031118142919.GI4953@libertyrms.info> <1069180780.2769.91.camel@haggis.homelan> <019301c3ae07$d714e220$0700a8c0@trogdor> <87llqdqy37.fsf@asmodeus.mcnaught.org> <20031118205057.K606@hermes.hilbert.loc> <01b201c3ae14$92bd3c00$0700a8c0@trogdor> <3FBA8911.5060805@mascari.com> <01cc01c3ae1c$b54fa980$0700a8c0@trogdor> <01b401c3afa8$2ba201f0$0700a8c0@trogdor> Mime-Version: 1.0 Content-Type: text/plain; charset=unknown-8bit Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <01b401c3afa8$2ba201f0$0700a8c0@trogdor> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/1140 X-Sequence-Number: 52790 On Thu, Nov 20, 2003 at 01:52:10PM -0700, Rick Gigger wrote: > I worked around this by starting the transaction and inserting the 45,000 > rows and then killing it. The I removed the index and readded it which > apparently gathered some stats and since there were all of the dead tuples > in there from the failed transaction it now decided that it should use the > index. I reran the script and this time it took 5 minutes again instead of > 1 1/2 hours. Stats are not collected automatically. You should run ANALYZE after importing your data. And it's probably faster to create the index after the data is loaded, too. -- Alvaro Herrera () Y una voz del caos me habló y me dijo "Sonríe y sé feliz, podría ser peor". Y sonreí. Y fui feliz. Y fue peor.