Re: [SQL] Temp tables, reports in Postgresql (and other RDBMS)

2006-10-15 Thread ow
--- Tom Lane <[EMAIL PROTECTED]> wrote: > If you need some procedural logic (if-then-else stuff) Yes > then you'd need > to go over to plpgsql, which would be a bit of a pain because its habit > of caching query plans doesn't play nice with temp tables. Going to plpgsql is fine. What I'm tryin

Re: [SQL] Temp tables, reports in Postgresql (and other RDBMS)

2006-10-15 Thread Tom Lane
ow <[EMAIL PROTECTED]> writes: > We are considering moving some reports from *** to Postgres. Our reports are > written as stored procs in Transact-SQL and usually have the following > structure: > ... > How would one rewrite the above logic in Postgresql? If that's all you have to do, then SQL-la

Re: [SQL] Temp tables and functions

2006-10-11 Thread Mark R. Dingee
Thanks, Jim. I'll give it a try. On Tue, 2006-10-10 at 21:11 -0500, Jim C. Nasby wrote: > On Tue, Oct 10, 2006 at 03:21:36PM -0400, [EMAIL PROTECTED] wrote: > > Everyone, > > > > I've written a function (language = sql) which uses a temporary table to > > simplify the process; however, when I g

Re: [SQL] Temp tables and functions

2006-10-10 Thread Jim C. Nasby
On Tue, Oct 10, 2006 at 03:21:36PM -0400, [EMAIL PROTECTED] wrote: > Everyone, > > I've written a function (language = sql) which uses a temporary table to > simplify the process; however, when I go to load the function I get: > > /var/lib/pgsql$cat thm.sql | psql test > ERROR: relation "lost_b

Re: [SQL] TEMP tables

2003-02-03 Thread Tomasz Myrta
Lex Berezhny wrote: hi, I have a plpgsql procedure that needs to create a temporary table, use it as a stack internally, and then disgard it when the procedure exits. What are the recommendations or solutions on using temporary tables inside functions on a per call basis? thanks a lot, I

Re: [SQL] TEMP tables

2003-02-02 Thread Bruce Momjian
You need to use EXECUTE. See the FAQ, item 4.26. --- Lex Berezhny wrote: > hi, > > I have a plpgsql procedure that needs to create a temporary table, use > it as a stack internally, and then disgard it when the procedure e

Re: [SQL] Temp tables being written to disk. Avoidable? [Another TO-DO]

2001-08-24 Thread Chris Ruprecht
(Maybe this thread is dead now, but here goes anyway) Suggestion: have an environment variable or a PostgreSQL parameter to indicate where to write the temp-table to. This way, you could easily direct it to a RAM disk (if small enough) or to a drive other than your main database. Default could be

Re: [SQL] Temp tables being written to disk. Avoidable?

2001-08-20 Thread Tom Lane
Paul McGarry <[EMAIL PROTECTED]> writes: > Can I avoid having the temp table written to disk Not at present --- temp tables are not different from real tables, except for some naming shenanigans. So creation of a temp table will involve some disk hits. Do you really *need* a temp table, as oppo

RE: [SQL] Temp tables being written to disk. Avoidable?

2001-08-16 Thread Paul McGarry
Howdy, > If the temp table doesn't fit in memory, we will have to put it in > backing store somewhere, and a disk is the logical place, right? I > don't see a huge advantage of putting it in memory. We could prevent > WAL writes for temp tables. That would help. Yes, if it won't fit in memory

Re: [SQL] Temp tables being written to disk. Avoidable?

2001-08-15 Thread Bruce Momjian
> Hi Tom, > > Thanks for your response, enlightening as always. > > > Not at present --- temp tables are not different from real tables, > > except for some naming shenanigans. So creation of a temp table will > > involve some disk hits. > > Ok, would it be a good idea to modify that for the f

RE: [SQL] Temp tables being written to disk. Avoidable?

2001-08-14 Thread Paul McGarry
Hi Tom, Thanks for your response, enlightening as always. > Not at present --- temp tables are not different from real tables, > except for some naming shenanigans. So creation of a temp table will > involve some disk hits. Ok, would it be a good idea to modify that for the future? Given that

Re: [SQL] Temp Tables & Connection Pooling

2001-03-06 Thread Ian Harding
Gerald Gutierrez wrote: > At 12:48 PM 3/2/2001 -0800, David Olbersen wrote: > >On Fri, 2 Mar 2001, Gerald Gutierrez wrote: > > > >->Recently I wanted to implement Dijkstra's algorithm as a stored procedure, > >->and finding that PL/PGSQL cannot return record sets, I thought about using > >->a tem

Re: [SQL] Temp Tables & Connection Pooling

2001-03-03 Thread Gerald Gutierrez
At 12:48 PM 3/2/2001 -0800, David Olbersen wrote: >On Fri, 2 Mar 2001, Gerald Gutierrez wrote: > >->Recently I wanted to implement Dijkstra's algorithm as a stored procedure, >->and finding that PL/PGSQL cannot return record sets, I thought about using >->a temporary table for the results. If temp

Re: [SQL] Temp Tables & Connection Pooling

2001-03-03 Thread Richard Huxton
David Olbersen wrote: > > On Fri, 2 Mar 2001, Gerald Gutierrez wrote: > > ->Recently I wanted to implement Dijkstra's algorithm as a stored procedure, > ->and finding that PL/PGSQL cannot return record sets, I thought about using > ->a temporary table for the results. If tempoary tables are sess

Re: [SQL] Temp Tables & Connection Pooling

2001-03-02 Thread David Olbersen
On Fri, 2 Mar 2001, Gerald Gutierrez wrote: ->Recently I wanted to implement Dijkstra's algorithm as a stored procedure, ->and finding that PL/PGSQL cannot return record sets, I thought about using ->a temporary table for the results. If tempoary tables are session-specific, ->however, then would