Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qggbQ-00GoAO-M9 for pgsql-docs@arkaria.postgresql.org; Thu, 14 Sep 2023 07:17:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qggbP-006TM3-BD for pgsql-docs@arkaria.postgresql.org; Thu, 14 Sep 2023 07:17:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgXir-003PSu-5t for pgsql-docs@lists.postgresql.org; Wed, 13 Sep 2023 21:48:33 +0000 Received: from mail.seebs.net ([162.213.38.76]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgXin-004PDA-U8 for pgsql-docs@lists.postgresql.org; Wed, 13 Sep 2023 21:48:31 +0000 Received: from seebsdell (unknown [24.196.59.174]) by mail.seebs.net (Postfix) with ESMTPSA id 8166D2E8958; Wed, 13 Sep 2023 16:48:25 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=seebs.net; s=mail; t=1694641705; bh=F4x3H5vFhYgkHd2dWJZ2kqgvQwH6ZzVCpjqMsvqKUFE=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=oIzhNcM2gj6uVW5W0lnGWVEVYBJussWnq+778W/qoyFFf/bP9RPWPIJY3Y/Y3wGUY +1od+f1vTVYMjzBV4mLCvGMDW0yVOQydwBUVL+YwMreRHH2VSlgfVCb4PD+IPg+Mzy uuZoPsleZ0XoSXpYs2dtv50RZLIbdrW0qsb4Rs1/CgeEG0FCMdGUr3rU27EqANx7YZ 6/GuoBvhhe441noD9S9Yx0ff6hJs/Q8NCu9/z7F9Z+ECsRCJx23fX4gvWTfZ8IBLQx xKuj5Dpv2x5gdmfruFYsxvkSoo/fOG+tuBI2/Tx3NmRKiS0xulqgqzcgBMcAOE3Jsi 9shDaitIP20Rg== Date: Wed, 13 Sep 2023 16:48:22 -0500 From: Seebs To: "Euler Taveira" Cc: pgsql-docs@lists.postgresql.org Subject: Re: index access method documentation light on details on ii_AmCache Message-ID: <20230913164822.41e4c0bd@seebsdell> In-Reply-To: References: <169454016225.2433963.11433530945607791340@wrigleys.postgresql.org> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 13 Sep 2023 15:48:41 -0300 "Euler Taveira" wrote: > Unless you change it, ii_Context is CurrentMemoryContext (see > makeIndexInfo). Hence, your AM state information is freed when the > current memory context is freed. A thing I am now wondering: Is there anything in the postgresql documentation which explains this, or says when a given memory context will be freed? Like, is the ii_Context there for the lifetime of the index? For the lifetime of the query? For the lifetime of a single insert operation? I've found a reference to it in a third-party blog post, but I actually can't find anything in the docs explaining memory contexts, and a bit of experimenting makes me think they are doing things that aren't obvious to me. For instance, I tried *not* deleting a memory context when done with it, then looping doing a query which tried to create and populate it, and... memory usage did not go up. Making me think that maybe it gets reused? Or maybe it's implicitly deleted because it had a parent context? -s