Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iwr1r-0007ZU-P7 for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Jan 2020 17:21:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iwr1p-0007VO-BK for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Jan 2020 17:21:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iwr1o-0007VG-US for pgsql-hackers@lists.postgresql.org; Wed, 29 Jan 2020 17:21:25 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1iwr1l-0002sS-Mj for pgsql-hackers@postgresql.org; Wed, 29 Jan 2020 17:21:24 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 77E4521C4C92; Wed, 29 Jan 2020 20:21:20 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.200] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 38B2021C4C90; Wed, 29 Jan 2020 20:21:20 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1580318480; bh=NoJVmWDmX0579QQZYRYo1CgIBSOm1QSPtTW+QDlM3XU=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=ktdhWlV/FXTUEIxcDbOYuQBAgsCjUgel9qT9DpvPo/8tKAGisB46/grIFGz9qDv/9 fLnNgWGQtbhrLOkc+4Wb2iV/R3KiDzrJWikxD4PowdlBsWZyjopY+wijdwhmfFIqFx e1xGNM7cnqWjwDUSb0RMGAFuj0XF/vs3LFNbf/cE= Subject: Re: [Proposal] Global temporary tables To: Pavel Stehule Cc: Robert Haas , Tomas Vondra , =?UTF-8?B?5pu+5paH5peMKOS5ieS7jik=?= , PostgreSQL Hackers , =?UTF-8?B?6JSh5p2+6Zyy?= =?UTF-8?B?KOWtkOWYiSk=?= , "Cai, Le" , =?UTF-8?B?6JCn5bCR6IGqKOmTgeW6tSk=?= References: <24099f4e-742c-e92b-729c-77bac1ca80d4@postgrespro.ru> <3fef844f-0e73-8fcb-e4b6-595d6317b191@postgrespro.ru> <20200112015109.caab6qdr2ob6d5jv@development> <7dd64333-3b6f-5aae-20ac-5fde142902e1@postgrespro.ru> <2fd087e8-b03a-5996-e077-df010104177c@postgrespro.ru> <0bddbc6d-fed1-d56b-d39f-67352461b2d1@postgrespro.ru> <407d6499-950d-e3d9-acbc-a2e86d8b82a3@postgrespro.ru> <6cbc12a0-bf0e-0205-959e-d871eb7e7c3e@postgrespro.ru> From: Konstantin Knizhnik Message-ID: <2e7fc7af-34f7-f707-5100-2c3d24128aee@postgrespro.ru> Date: Wed, 29 Jan 2020 20:21:20 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------79C2F1A4CD83B54BE160190E" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------79C2F1A4CD83B54BE160190E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 29.01.2020 20:08, Pavel Stehule wrote: > > > > 2. Actually I do not propose some completely new approach. I try to > provide behavior with is compatible with regular tables. > If you create index for regular table, then it can be used in all > sessions, right? > > > I don't understand to this point. Regular tables shares data, shares > files. You cannot to separate it. More - you have to uses relatively > aggressive locks to be this operation safe. > > Nothing from these points are valid for GTT. GTT shares metadata. As far as them are not sharing data, then GTT are safer than regular table, aren't them? "Safer" means that we need less "aggressive" locks for them: we need to protect only metadata, not data itself. My point is that if we allow other sessions to access created indexes for regular tables, then it will be not more complex to support it for GTT. Actually "not more complex" in this case means "no extra efforts are needed". -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --------------79C2F1A4CD83B54BE160190E Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

On 29.01.2020 20:08, Pavel Stehule wrote:



2. Actually I do not propose some completely new approach. I try to
provide behavior with is compatible with regular tables.
If you create index for regular table, then it can be used in all
sessions, right?

I don't understand to this point. Regular tables shares data, shares files. You cannot to separate it. More - you have to uses relatively aggressive locks to be this operation safe.

Nothing from these points are valid for GTT.

GTT shares metadata.
As far as them are not sharing data, then GTT are safer than regular table, aren't them?
"Safer" means that we need less "aggressive" locks for them: we need to protect only metadata, not data itself.

My point is that if we allow other sessions to access created indexes for regular tables, then it will be not more complex to support it for GTT.
Actually "not more complex" in this case means "no extra efforts are needed".

-- 
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company 
--------------79C2F1A4CD83B54BE160190E--