Re: temp tables should not have pg_shdepend entries

Lists: pgsql-hackers
From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: temp tables should not have pg_shdepend entries
Date: 2008-04-08 16:25:28
Message-ID: 20080408162528.GC9062@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Among the consequences of creating a temp table is the fact that we
create pg_shdepend entries for the owner. This is largely unnecessary
-- we only need it when the table owner is not the authenticated user.
I hereby propose we don't create those entries, since obviously the
tables would go away as soon as the connection goes away anyway, and the
user cannot go away until the connection does.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: temp tables should not have pg_shdepend entries
Date: 2008-04-08 16:29:55
Message-ID: 200804081629.m38GTtC14470@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Among the consequences of creating a temp table is the fact that we
> create pg_shdepend entries for the owner. This is largely unnecessary
> -- we only need it when the table owner is not the authenticated user.
> I hereby propose we don't create those entries, since obviously the
> tables would go away as soon as the connection goes away anyway, and the
> user cannot go away until the connection does.

But what if some application is using those dependencies while the
session is running? What is the advantage of not having the entries?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: temp tables should not have pg_shdepend entries
Date: 2008-04-08 16:34:13
Message-ID: 20080408163413.GE9062@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > Among the consequences of creating a temp table is the fact that we
> > create pg_shdepend entries for the owner. This is largely unnecessary
> > -- we only need it when the table owner is not the authenticated user.
> > I hereby propose we don't create those entries, since obviously the
> > tables would go away as soon as the connection goes away anyway, and the
> > user cannot go away until the connection does.
>
> But what if some application is using those dependencies while the
> session is running? What is the advantage of not having the entries?

The only use of the dependencies is to disallow dropping the user that
owns the table. But a connected user cannot be dropped.

... or so I thought :-( Actually you can delete a connected user, but
things do not go well after you do:

alvherre=> create table test (a int);
ERREUR: le rôle 32792 a été supprimé simultanément

So now my thinking is that we should disallow dropping a connected user.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: temp tables should not have pg_shdepend entries
Date: 2008-04-08 17:18:11
Message-ID: 3252.1207675091@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> So now my thinking is that we should disallow dropping a connected user.

I agree with that, but I think your idea of not making the pg_shdepend
entries is a pointless and possibly dangerous micro-optimization.
How much actual speedup would it provide, anyway?

regards, tom lane


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: temp tables should not have pg_shdepend entries
Date: 2008-04-08 17:21:29
Message-ID: 20080408172129.GI9062@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > So now my thinking is that we should disallow dropping a connected user.
>
> I agree with that, but I think your idea of not making the pg_shdepend
> entries is a pointless and possibly dangerous micro-optimization.
> How much actual speedup would it provide, anyway?

Speedup? Not sure -- I'm more worried about catalog bloat for people
who create lots of temp tables.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: temp tables should not have pg_shdepend entries
Date: 2008-04-08 17:42:02
Message-ID: 3603.1207676522@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Tom Lane wrote:
>> I agree with that, but I think your idea of not making the pg_shdepend
>> entries is a pointless and possibly dangerous micro-optimization.
>> How much actual speedup would it provide, anyway?

> Speedup? Not sure -- I'm more worried about catalog bloat for people
> who create lots of temp tables.

They're going to have far more bloat in pg_class, pg_attribute, etc.

A more useful thing to do to save catalog bloat would be to stop storing
the 100%-predictable pg_attribute entries for system columns --- that'd
save six or seven rows per table, not just one.

regards, tom lane


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: temp tables should not have pg_shdepend entries
Date: 2008-04-08 18:28:18
Message-ID: 20080408182818.GK9062@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > Tom Lane wrote:
> >> I agree with that, but I think your idea of not making the pg_shdepend
> >> entries is a pointless and possibly dangerous micro-optimization.
> >> How much actual speedup would it provide, anyway?
>
> > Speedup? Not sure -- I'm more worried about catalog bloat for people
> > who create lots of temp tables.
>
> They're going to have far more bloat in pg_class, pg_attribute, etc.

But these are not shared catalogs.

> A more useful thing to do to save catalog bloat would be to stop storing
> the 100%-predictable pg_attribute entries for system columns --- that'd
> save six or seven rows per table, not just one.

Agreed.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.