Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiTCM-00086w-PL for pgsql-general@arkaria.postgresql.org; Wed, 25 Jul 2018 23:28:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fiTCK-0008Qj-FV for pgsql-general@arkaria.postgresql.org; Wed, 25 Jul 2018 23:28:00 +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.89) (envelope-from ) id 1fiTCK-0008QU-7X; Wed, 25 Jul 2018 23:28:00 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiTCD-0000Ai-7u; Wed, 25 Jul 2018 23:27:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w6PNRlmt015804; Wed, 25 Jul 2018 19:27:47 -0400 From: Tom Lane To: Andres Freund cc: Luca Ferrari , pgsql-bugs@postgresql.org, Peter Geoghegan , pgsql-general Subject: Re: could not read block 0 in file : read only 0 of 8192 bytes when doing nasty on immutable index function In-reply-to: <20180725231719.orjox4w6qhvopeck@alap3.anarazel.de> References: <20180627204439.4b7miflyolm4qtcz@alap3.anarazel.de> <20180628150209.n2qch5jtn3vt2xaa@alap3.anarazel.de> <20180725231719.orjox4w6qhvopeck@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Wed, 25 Jul 2018 16:17:19 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15802.1532561267.1@sss.pgh.pa.us> Date: Wed, 25 Jul 2018 19:27:47 -0400 Message-ID: <15803.1532561267@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2018-06-28 08:02:10 -0700, Andres Freund wrote: >> I wonder why we don't just generally trigger invalidations to an >> indexes' "owning" relation in CacheInvalidateHeapTuple()? > Tom, do you have any comments about the above? It seems like an ugly and fragile hack, offhand. I can see the point about needing to recompute the owning relation's index list, but there's no good reason why an update of a pg_index row ought to force that. You're using that as a proxy for creation or deletion of an index, but (at least in principle) pg_index rows might get updated for existing indexes. Also, it's not clear to me why the existing places that force relcache inval on the owning table during index create/delete aren't sufficient already. I suppose it's probably a timing problem, but it's not clear why hacking CacheInvalidateHeapTuple in this fashion fixes that, or why we could expect it to stay fixed. regards, tom lane