pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: David Olbersen <dave@slickness.org>
Cc: Gerald Gutierrez <pozix@home.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Temp Tables & Connection Pooling
Date: Sat, 03 Mar 2001 15:32:07 +0000
Message-ID: <3AA10E77.B63D172B@archonet.com> (raw)
References: <Pine.LNX.4.31.0103021247290.18710-100000@bubbles.electricutopia.net>

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 session-specific,
> ->however, then wouldn't connection pooling make it unusable since the table
> ->might "disappear" from one query to the next? What are alternative
> ->approaches to implementing Dijkstra's algorithm inside the database?
> 
> <newbie>
> Wouldn't a VIEW do what you want?
> </newbie>
> 
> -- Dave

Presumably Gerald's after speed here - IIRC Dijkstra's is shortest path
finder, so probably not cheap.

I was thinking about the temp table problem the other day, and the best
I could come up with involved creating a higher-level connection
(application-level session basically). You'd create a table mytempNNN
(where NNN is a unique number to identify your user's session) and add a
line to a tracking table (NNN,now())

Every time you use mytempNNN update the tracking table's time and run a
separate reaper process to kill anything not used for 15 minutes (or whatever).

You should be able to automate this to a degree with triggers etc.

- Richard Huxton



view thread (5+ messages)  latest in thread

Message-ID: <3AA10E77.B63D172B@archonet.com>
Permalink:  ../3AA10E77.B63D172B@archonet.com/
Also on:    postgresql.org/message-id/3AA10E77.B63D172B@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, dave@slickness.org, pozix@home.com
  Subject: Re: Temp Tables & Connection Pooling
  In-Reply-To: <3AA10E77.B63D172B@archonet.com>
  References: <Pine.LNX.4.31.0103021247290.18710-100000@bubbles.electricutopia.net> <3AA10E77.B63D172B@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox