Re: Self-referencing table question - Mailing list pgsql-sql

From Sean Davis
Subject Re: Self-referencing table question
Date
Msg-id 62cd9fffe536b0665a1da78478c4ec20@mail.nih.gov
Whole thread Raw
In response to Re: Self-referencing table question  (Edmund Bacon <ebacon@onesystem.com>)
Responses Re: Self-referencing table question
List pgsql-sql
On Mar 24, 2005, at 1:11 PM, Edmund Bacon wrote:

> Sean Davis wrote:
>
>> Thanks.  I thought about that a bit and it seems like it is highly 
>> likely to be expensive for a single query (though I should probably 
>> try it at some point).  If I do find myself reformatting results 
>> after response to user input (i.e., reusing the query), though, then 
>> your solution is likely to be very useful.
>>
>
>
> Note that the subselect version takes about 10 times as long as the 
> temptable version, and does not seem to be dependent on what data 
> might be cached.
>>>

Nice.  Thanks for doing my work for me!  I guess I will have to think 
about it more seriously.

It could be a slight bit complicated because my code is running under 
mod_perl, so connections are cached.  As I understand it, the temp 
table will stick around, so I will have to be careful to explicitly 
drop it if I don't want it to persist?  Also each table will need a 
unique name (I have a session_id I can use), as it is possible that 
multiple temp tables will exist and be visible to each other?


Thanks again,
Sean



pgsql-sql by date:

Previous
From: "Moran.Michael"
Date:
Subject: Re: Funtions + plpgsql + contrib/pgcrypto = ??
Next
From: Edmund Bacon
Date:
Subject: Re: Self-referencing table question