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.
It returns 752 rows, and the table is autovacuumed. If I run the queries manually, they take ~15ms in all -- for some odd reason, the function in itself varies between 40 and 500ms, though... I tried using TRUNCATE earlier, but if anything, it made the function slower (might just have been zero difference, though). I also had written the function differently (using a series of depth-first searches), but it was awfully slow even after a lot of tweaking, so it was not really worth it... /* Steinar */ -- Homepage: http://www.sesse.net/ ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match