X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 99145D8A1B for ; Sun, 23 Oct 2005 07:23:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82224-10 for ; Sun, 23 Oct 2005 10:23:30 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 0585FD8637 for ; Sun, 23 Oct 2005 07:23:31 -0300 (ADT) Received: from sesse by cassarossa.samfundet.no with local (Exim 4.50) id 1ETd0n-0002Wy-SB for pgsql-performance@postgresql.org; Sun, 23 Oct 2005 12:23:33 +0200 Date: Sun, 23 Oct 2005 12:23:33 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Materializing a sequential scan Message-ID: <20051023102333.GA9356@samfundet.no> References: <20051019174544.GA32303@samfundet.no> <4248.1129783045@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4248.1129783045@sss.pgh.pa.us> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 required=5 tests=[AWL=0.011] X-Spam-Level: X-Archive-Number: 200510/314 X-Sequence-Number: 15082 On Thu, Oct 20, 2005 at 12:37:25AM -0400, Tom Lane wrote: > That mdb_gruppekobling_transitiv_tillukning function looks awfully > grotty ... how many rows does it return, and how long does it take to > run by itself? How often does its temp table get vacuumed? A quick > band-aid might be to use TRUNCATE instead of DELETE FROM to clean the > table ... but if I were you I'd try to rewrite the function entirely. I've verified that it indeed does use 20ms more for every run without a VACUUM, but it shouldn't really matter -- and I guess it will go away once somebody teaches plpgsql about not caching OIDs for CREATE TEMPORARY TABLE. :-) In any case, I still can't understand why it picks the plan it does; what's up with the materialized seqscan, and where do the four million rows come from? 7.4 estimates ~52000 disk page fetches for the same query, so surely there must be a better plan than four million :-) /* Steinar */ -- Homepage: http://www.sesse.net/