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 6667ED9C48 for ; Thu, 20 Oct 2005 01:37:33 -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 72746-02 for ; Thu, 20 Oct 2005 04:37:31 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 302A4DA6D5 for ; Thu, 20 Oct 2005 01:37:31 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j9K4bPiH004249; Thu, 20 Oct 2005 00:37:25 -0400 (EDT) To: "Steinar H. Gunderson" Cc: pgsql-performance@postgresql.org Subject: Re: Materializing a sequential scan In-reply-to: <20051019174544.GA32303@samfundet.no> References: <20051019174544.GA32303@samfundet.no> Comments: In-reply-to "Steinar H. Gunderson" message dated "Wed, 19 Oct 2005 19:45:44 +0200" Date: Thu, 20 Oct 2005 00:37:25 -0400 Message-ID: <4248.1129783045@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200510/272 X-Sequence-Number: 15040 "Steinar H. Gunderson" writes: > I'm using PostgreSQL 8.1 beta 3 (packages from Debian experimental), and I > have a (rather complex) query that seems to take forever -- when the database > was just installed, it took about 1200ms (which is quite good, considering > that the 7.4 system this runs on today uses about the same time, but has > twice as much CPU power and runs sequential scans up to eight times as fast), > but now I can never even get it to complete. I've tried running it for half > an hour, but it still doesn't complete, so I'm a bit unsure what's going on. 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. regards, tom lane