"Steinar H. Gunderson" <sgunderson@bigfoot.com> 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