Re: [Proposal] Global temporary tables

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: 曾文旌(义从) <wenjing(dot)zwj(at)alibaba-inc(dot)com>
Cc: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Erik Rijkers <er(at)xs4all(dot)nl>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, 蔡松露(子嘉) <zijia(at)taobao(dot)com>, "Cai, Le" <le(dot)cai(at)alibaba-inc(dot)com>, 萧少聪(铁庵) <shaocong(dot)xsc(at)alibaba-inc(dot)com>
Subject: Re: [Proposal] Global temporary tables
Date: 2020-02-05 14:15:46
Message-ID: CA+TgmoZoKii4b-HHZDWEW8iDme0rB=rfc9O2pZUVA05aM9GXaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 5, 2020 at 8:21 AM 曾文旌(义从) <wenjing(dot)zwj(at)alibaba-inc(dot)com> wrote:
> What do you mean by "catalog buffer"?
> Yes, cleanup of local temp table requires deletion of correspondent entry from catalog and GTT should not do it.
> But I am speaking only about cleanup of data files of temp relations. It is done in the same way for local and global temp tables.
>
> For native pg, the data file of temp table will not be cleaned up direct after oom happen.
> Because the orphan local temp table(include catalog, local buffer, datafile) will be cleaned up by deleting the orphan temp schame in autovacuum.
> So for GTT ,we cannot do the same with just deleting data files. This is why I dealt with it specifically.

After a crash restart, all temporary relfilenodes (e.g t12345_67890)
are removed. I think GTTs should use relfilenodes of this general
form, and then they'll be cleaned up by the existing code. For a
regular temporary table, there is also the problem of removing the
catalog entries, but GTTs shouldn't have this problem, because a GTT
doesn't have any catalog entries for individual sessions, just for the
main object, which isn't going away just because the system restarted.
Right?

> In my patch autovacuum is prohibited for GTT.
>
> But vacuum GTT is not prohibited.

That sounds right to me.

This thread is getting very hard to follow because neither Konstantin
nor Wenjing seem to be using the standard method of quoting. When I
reply, I get the whole thing quoted with "> " but can't easily tell
the difference between what Wenjing wrote and what Konstantin wrote,
because both of your mailers are quoting using indentation rather than
"> " and it gets wiped out by my mailer. Please see if you can get
your mailer to do what is normally done on this mailing list.

Thanks,

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2020-02-05 14:19:04 Re: Is custom MemoryContext prohibited?
Previous Message Robert Haas 2020-02-05 14:10:11 Re: [Proposal] Global temporary tables