Re: sharing temporary tables - Mailing list pgsql-novice

From Tom Lane
Subject Re: sharing temporary tables
Date
Msg-id 4300.1093362914@sss.pgh.pa.us
Whole thread Raw
In response to sharing temporary tables  ("Marcus Andree S. Magalhaes" <marcus.magalhaes@vlinfo.com.br>)
List pgsql-novice
"Marcus Andree S. Magalhaes" <marcus.magalhaes@vlinfo.com.br> writes:
> Do temp tables reside on disk or in RAM?

They are files, just like every other table in Postgres.  To the extent
that you have RAM to spare, the kernel will keep the contents of active
files in memory, so it's quite possible for a table to behave as though
it's in RAM (at least in terms of read speed).

> Can different connections
> access (share) data located in a temporary table created by a
> previous connection/process?

No.  Temp tables are local to a single session.  There are a number of
performance optimizations associated with that, which boil down to the
fact that other sessions couldn't see a consistent state of the data in
a temp table even if they looked (which they won't).

            regards, tom lane

pgsql-novice by date:

Previous
From: Gaetano Mendola
Date:
Subject: Re: MySQL vs PostgreSQL
Next
From: Steve Crawford
Date:
Subject: Re: MySQL vs PostgreSQL