Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b3LDJ-0003ZN-BN for pgsql-hackers@arkaria.postgresql.org; Thu, 19 May 2016 10:29:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b3LDI-0007ij-Tg for pgsql-hackers@arkaria.postgresql.org; Thu, 19 May 2016 10:29:56 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b3LDI-0007iT-44 for pgsql-hackers@postgresql.org; Thu, 19 May 2016 10:29:56 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b3LDD-0002XA-IC for pgsql-hackers@postgresql.org; Thu, 19 May 2016 10:29:54 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id u4JATjF7007537; Thu, 19 May 2016 19:29:45 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 7B5CD5F611; Thu, 19 May 2016 19:29:45 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 6E53B5F594; Thu, 19 May 2016 19:29:45 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTP id 63E2B400613; Thu, 19 May 2016 19:29:45 +0900 (JST) Subject: Re: Declarative partitioning References: <55D3093C.5010800@lab.ntt.co.jp> <56DF74F0.7060404@lab.ntt.co.jp> <56F0AC96.2010303@lab.ntt.co.jp> <57106F9E.3000309@lab.ntt.co.jp> <57163954.2020701@postgrespro.ru> <571759D8.7030205@lab.ntt.co.jp> <57179653.30905@postgrespro.ru> <57183572.8020900@lab.ntt.co.jp> <5739C742.80504@postgrespro.ru> <573ACEB2.1090705@lab.ntt.c! o.jp> <1404.1463505762@sss.pgh.! pa.us> <573BC4DB.2040507@lab.ntt.co.jp> <14105.1463593739@sss.pgh.pa.us> From: Amit Langote Message-ID: <573D958D.4040308@lab.ntt.co.jp> Date: Thu, 19 May 2016 19:29:33 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <14105.1463593739@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit To: Tom Lane Cc: Ildar Musin , pgsql-hackers@postgresql.org X-TM-AS-MML: disable X-Pg-Spam-Score: -4.0 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2016/05/19 2:48, Tom Lane wrote: > Amit Langote writes: >> On 2016/05/18 2:22, Tom Lane wrote: >>> The two ways that we've dealt with this type of hazard are to copy data >>> out of the relcache before using it; or to give the relcache the >>> responsibility of not moving a particular portion of data if it did not >>> change. From memory, the latter applies to the tuple descriptor and >>> trigger data, but we've done most other things the first way. > > After actually looking at the code, we do things that way for the > tupledesc, the relation's rules if any, and RLS policies --- see > RelationClearRelation(). I think I confused refcounting method of keeping things around with the RelationClearRelation()'s method. I now understand that you meant the latter in your original message. >> It seems that tuple descriptor is reference-counted; however trigger data >> is copied. The former seems to have been done on performance grounds (I >> found 06e10abc). > > We do refcount tuple descriptors, but we've been afraid to try to rely > completely on that; there are too many places that assume a relcache > entry's tupdesc is safe to reference. It's not that easy to go over to > a fully refcounted approach, because that creates a new problem of being > sure that refcounts are decremented when necessary --- that's a pain, > particularly when a query is abandoned due to an error. I see. >> So for a performance-sensitive relcache data structure, refcounting is the >> way to go (although done quite rarely)? > > I'd be suspicious of this because of the cleanup problem. The > don't-replace-unless-changed approach is the one that's actually battle > tested. OK, I will try the RelationClearRelation()'s method of keeping partition descriptor data around so that no repeated copying is necessary. Thanks, Amit -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers