From: | Jasen Betts <jasen(at)xnet(dot)co(dot)nz> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Temp table or normal table for performance? |
Date: | 2009-08-20 13:43:10 |
Message-ID: | h6jjte$ato$2@reversiblemaps.ath.cx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2009-08-19, Stephen Cook <sclists(at)gmail(dot)com> wrote:
> Let's say I have a function that needs to collect some data from various
> tables and process and sort them to be returned to the user.
plpgsql functions don't play well with temp tables IME.
there are work-arounds and they are ugly. if you caus use a different
language it could work.
> In general, would it be better to create a temporary table in that
> function, do the work and sorting there, and return it... or keep a
> permanent table for pretty much the same thing, but add a "user session"
> field and return the relevant rows from that and then delete them?
> Sorry this is vague, I know it most likely depends on the workload and
> such, but I'm just putting this together now. I could go either way, and
> also switch it up in the future if necessary. Is there a rule of thumb
> on this one? I'm a bit biased against temporary tables, but then again
> if the normal table gets a lot of action it might not be the optimal choice.
temp tables are usually worth the effort.
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2009-08-20 13:45:45 | Re: ERROR: could not access file "$libdir/xxid": No such file or directory |
Previous Message | Jasen Betts | 2009-08-20 13:28:24 | Re: PL/PGSQL: why IF test the whole condition before failing or not? |