Re: How to write a function that manipulates a set of results - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: How to write a function that manipulates a set of results
Date
Msg-id 20070314230231.GB30723@alvh.no-ip.org
Whole thread Raw
In response to Re: How to write a function that manipulates a set of results  (Ashley Moran <work@ashleymoran.me.uk>)
Responses Re: How to write a function that manipulates a set of results  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Ashley Moran wrote:
>
> On Mar 14, 2007, at 7:25 pm, Tom Lane wrote:
> >Sure: use a table.  What was the objection to temp tables exactly?
>
> My boss is under the impression that calling the procedure twice on
> the same connection creates a name conflict for the temporary table.
>
> Also I'm unsure how the use of temporary tables will affect the
> running of the query.  This function will be called up to 400 times
> by a wrapping function that needs to complete quickly (relatively -
> the calculations need to return in a few seconds).  I haven't had
> chance to read much about PG temp tables yet, so I don't know how the
> implementation works.  Are small tables stored in RAM, or does
> creating a temporary table always force a disk write?

Temp tables stay in RAM until they are bigger than temp_buffers.  If you
need them to be big and quick, maybe it would be appropriate to use
indexes (note these count towards temp_buffers), ANALYZE, etc.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: How to write a function that manipulates a set of results
Next
From: Tomasz Rakowski
Date:
Subject: database locks