Thread: pg_temp schemas

pg_temp schemas

From
"Fernando Papa"
Date:
Hi everybody!

We are using postgres on solaris 7.3.1. for several weeks.
Today I see several schemas nammed pg_temp_1, pg_temp_6, pg_temp_10,
pg_temp_7, pg_temp_9.
What are this schemas?
Any relation with "create local temporary table"?
these schemas doesn't recycle? or clean?

thanks a lot!

--
Fernando O. Papa

Re: pg_temp schemas

From
Tom Lane
Date:
"Fernando Papa" <fpapa@claxson.com> writes:
> We are using postgres on solaris 7.3.1. for several weeks.
> Today I see several schemas nammed pg_temp_1, pg_temp_6, pg_temp_10,
> pg_temp_7, pg_temp_9.

This is normal.  The temp schemas are left around, since there doesn't
seem to be much reason to delete catalog entries only to have to create
them again.

            regards, tom lane

Re: pg_temp schemas

From
"Fernando Papa"
Date:
Hi Tom, thanks for your reply.
What is the origin of these schemas? local temporary tables? sorts?
Thanks a lot!

--
Fernando O. Papa
DBA
Claxson - Tecnología
Tel: (54-11) 4546-8000 Int. 3854
Fax: (54-11) 4546-8051


> -----Mensaje original-----
> De: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Enviado el: jueves, 06 de febrero de 2003 18:07
> Para: Fernando Papa
> CC: pgsql-general@postgresql.org
> Asunto: Re: [GENERAL] pg_temp schemas
>
>
> "Fernando Papa" <fpapa@claxson.com> writes:
> > We are using postgres on solaris 7.3.1. for several weeks.
> Today I see
> > several schemas nammed pg_temp_1, pg_temp_6, pg_temp_10, pg_temp_7,
> > pg_temp_9.
>
> This is normal.  The temp schemas are left around, since
> there doesn't seem to be much reason to delete catalog
> entries only to have to create them again.
>
>             regards, tom lane
>

Re: pg_temp schemas

From
Tom Lane
Date:
"Fernando Papa" <fpapa@claxson.com> writes:
> What is the origin of these schemas? local temporary tables? sorts?

Right, they're made to hold temporary tables.  The first time a given
backend does CREATE TEMP TABLE, it looks for a pg_temp_n schema, and
makes it if it's not there.  On shutdown, it removes the temp tables,
but it seemed like a waste of cycles to remove the pg_temp_n schema
itself.

(ObTrivialFact: the 'n' is the backend's pgproc slot number, so it's
known not to be in use by any concurrently running backend.  But it
will certainly be used again in future.)

            regards, tom lane