Re: TEMP tables

Поиск
Список
Период
Сортировка
От Tomasz Myrta
Тема Re: TEMP tables
Дата
Msg-id 3E3E3C83.3010607@klaster.net
обсуждение исходный текст
Ответ на TEMP tables  (Lex Berezhny <LBerezhny@DevIS.com>)
Список pgsql-sql
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.
> 

<cut>

> What are the recommendations or solutions on using temporary tables
> inside functions on a per call basis?
> 
> thanks a lot,

Instead of Bruce solution you can:
1. Create your temporary table only once after you login into database.
Before each execution of your function just delete/truncate this temporary table.
You don't need to drop this table, because it is 
automatically dropped when the session is finished.

2. Use global table as a stack. Use some sessionid to indetify stack for
each procedure execution. Create index on sessionid. There is one more
advantage on this solution - you can use views without recreating them.


Regards,
Tomasz Myrta





В списке pgsql-sql по дате отправления:

Предыдущее
От: "David Durst"
Дата:
Сообщение: Commenting PLPGSQL
Следующее
От: Tomasz Myrta
Дата:
Сообщение: Re: Commenting PLPGSQL