Re: PROPOSAL: Fast temporary tables

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PROPOSAL: Fast temporary tables
Date: 2016-03-01 16:30:59
Message-ID: CAFj8pRDnX6jS_wcvy78uK_Cf7gi5YUyoX3epogXMCTCSvXDRMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2016-03-01 17:00 GMT+01:00 Robert Haas <robertmhaas(at)gmail(dot)com>:

> On Tue, Mar 1, 2016 at 10:52 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru> writes:
> >> There are applications that create and delete a lot of temporary
> >> tables. Currently PostgreSQL doesn't handle such a use case well.
> >
> > True.
> >
> >> Fast temporary tables work almost as usual temporary tables but they
> >> are not present in the catalog. Information about tables is stored in
> >> shared memory instead. This way we solve a bloating problem.
> >
> > I think you have no concept how invasive that would be. Tables not
> > represented in the catalogs would be a disaster, because *every single
> > part of the backend* would have to be modified to deal with them as
> > a distinct code path --- parser, planner, executor, loads and loads
> > of utility commands, etc. I do not think we'd accept that. Worse yet,
> > you'd also break client-side code that expects to see temp tables in
> > the catalogs (consider psql \d, for example).
> >
> > I think a workable solution to this will still involve catalog entries,
> > though maybe they could be "virtual" somehow.
>
> Yeah, I have a really hard time believing this can ever work. There
> are MANY catalog tables potentially involved here - pg_class,
> pg_attribute, pg_attrdef, pg_description, pg_trigger, ... and loads
> more - and they all can have OID references to each other. If you
> create a bunch of fake relcache and syscache entries, you're going to
> need to give them OIDs, but where will those OIDs come from? What
> guarantees that they aren't in use, or won't be used later while your
> temporary object still exists? I think making this work would make
> parallel query look like a minor feature.
>

The global temp tables can decrease these issues. Only few informations
should be private - and can be accessed via extra function call. Almost all
information can be shared in stable catalogue.

The private data are rownumbers, column statistics and the content
(filenode). Any other can be used from catalogue.

Regards

Pavel

>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Verite 2016-03-01 16:43:00 Re: pg_dump / copy bugs with "big lines" ?
Previous Message Pavel Stehule 2016-03-01 16:18:25 Re: Proposal: SET ROLE hook