Re: [Proposal] Global temporary tables

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: wenjing zeng <wjzeng2012(at)gmail(dot)com>
Cc: Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, 蔡松露(子嘉) <zijia(at)taobao(dot)com>, "Cai, Le" <le(dot)cai(at)alibaba-inc(dot)com>
Subject: Re: [Proposal] Global temporary tables
Date: 2020-07-23 06:54:25
Message-ID: CAFj8pRAFb0da-+w+8vXB3_OWrC4O183__NQvzOYyGq299z=H6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I am thinking about explicit LOCK statements. Some applications use
> explicit locking from some reasons - typically as protection against race
> conditions.
>
> But on GTT race conditions are not possible. So my question is - does the
> exclusive lock on GTT protection other sessions do insert into their own
> instances of the same GTT?
>
> In my opinion, with a GTT, always work on the private data of the session,
> there is no need to do anything by holding the lock, so the lock statement
> should do nothing (The same is true for ORACLE GTT)
>
> What do you think?
>
>
> What is a level where table locks are active? shared part of GTT or
> session instance part of GTT?
>
> I don't quite understand what you mean, could you explain it a little bit?
>

It is about perspective, how we should see GTT tables. GTT table is a mix
of two concepts - session private (data), and session shared (catalog). And
hypothetically we can place locks to the private part (no effect) or shared
part (usual effect how we know it). But can has sense, and both have an
advantage and disadvantage. I afraid little bit about behaviour of stupid
ORM systems - but the most important part of table are data - and then I
prefer empty lock implementation for GTT.

Regards

Pavel

>
>
> Wenjing
>
>
>
>
>
>
>
>>
>> Wenjing
>>
>>
>>
>> Now, table locks are implemented on a global level. So exclusive lock on
>> GTT in one session block insertion on the second session. Is it expected
>> behaviour? It is safe, but maybe it is too strict.
>>
>> We should define what table lock is meaning on GTT.
>>
>> Regards
>>
>> Pavel
>>
>>
>>> Pavel
>>>
>>>
>>>> With Regards,
>>>> Prabhat Kumar Sahu
>>>> EnterpriseDB: http://www.enterprisedb.com
>>>>
>>>>
>>>>
>>>
>>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2020-07-23 07:24:05 Re: Parallel worker hangs while handling errors.
Previous Message Andrey V. Lepikhov 2020-07-23 06:23:42 Re: [POC] Fast COPY FROM command for the table with foreign partitions