From: | Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: slow SP with temporary tables, PLPGSQL problems |
Date: | 2005-02-13 08:52:31 |
Message-ID: | Pine.LNX.4.44.0502130940140.15239-100000@kix.fsv.cvut.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> > Create the temp table only once per connection (you can use ON COMMIT
> > DELETE ROWS instead of ON COMMIT DROP to clean it out). Then you won't
> > need to use EXECUTE.
> >
I am sorry, first time I didn't understand. Now I did some test and its
good adivice. Sometimes I have problem understand so I can use temp.
tables on an level of connection and its not neccesery push temp tables on
SP level. If I don't change structure of temp tables (and its unpropably
on produstion database) I haven't problems. I have still one question.
What is possible so I can
CREATE OR REPLACE FONCTION foo() ..
BEGIN CREATE TEMP TABLE xxx(...
INSERT INTO xxx VALUES (...
It's works, but in time of compilation SP temp table xxx doesn't exists.
It's mean so Id in cmd INSERT is little bit dynamic?
I rewrite my SP and I have one notice: In documentation is note, so
TRUNCATE TABLE is faster then DELETE FROM. It's not true for small temp
tables. On my computer TRUNCATE needs 100ms and DELETE 8ms. It's general
or any exception?
Thank You
Pavel Stehule
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-02-13 10:24:27 | Re: creating the same table in 2 different sessions |
Previous Message | Markus Bertheau | 2005-02-13 01:50:00 | Re: prev main developer page |