Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b2qHy-0000aH-M3 for pgsql-hackers@arkaria.postgresql.org; Wed, 18 May 2016 01:28:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b2qHw-0001Jb-Vs for pgsql-hackers@arkaria.postgresql.org; Wed, 18 May 2016 01:28:41 +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 1b2qGa-0008DJ-KM for pgsql-hackers@postgresql.org; Wed, 18 May 2016 01:27:16 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b2qGV-0007l0-Cc for pgsql-hackers@postgresql.org; Wed, 18 May 2016 01:27:15 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id u4I1R12H012293; Wed, 18 May 2016 10:27:01 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id DC2315F593; Wed, 18 May 2016 10:27:01 +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 CFFBE5F58E; Wed, 18 May 2016 10:27:01 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTP id C0ADD40085A; Wed, 18 May 2016 10:27:01 +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> From: Amit Langote Message-ID: <573BC4DB.2040507@lab.ntt.co.jp> Date: Wed, 18 May 2016 10:26:51 +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: <1404.1463505762@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/18 2:22, Tom Lane wrote: > Amit Langote writes: >> On 2016/05/16 22:12, Ildar Musin wrote: >>> Could you please tell is >>> it possible that relcache invalidation occurs during SELECT/UPDATE/DELETE >>> query? > >> Hmm, I think invalidation would not occur mid-query since it would have >> acquired a lock on the table. > > This is incorrect: invalidation can occur anyway (for example, if > autoanalyze updates the relation's statistics). If you are holding > a lock, you can expect that the relation's schema will not change more > than your lock would allow --- but a cache flush and rebuild could happen > underneath you, so keeping a pointer to any subsidiary relcache data > structure is very dangerous. I see. Thanks for clarifying. > 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. 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). So for a performance-sensitive relcache data structure, refcounting is the way to go (although done quite rarely)? In this particular case, it is a "partition descriptor" that could get big for a partitioned table with partitions in hundreds or thousands. 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