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 1tAamL-00GbyR-55 for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Nov 2024 20:12:52 +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 1tAamH-000BZn-Uz for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Nov 2024 20:12:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tAamH-000BZX-LV for pgsql-hackers@lists.postgresql.org; Mon, 11 Nov 2024 20:12:50 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tAamE-001Pst-7d for pgsql-hackers@lists.postgresql.org; Mon, 11 Nov 2024 20:12:49 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43163667f0eso41560725e9.0 for ; Mon, 11 Nov 2024 12:12:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bowt-ie.20230601.gappssmtp.com; s=20230601; t=1731355966; x=1731960766; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eH/IK9UETBwIzrJMbjxMVLpsFzyanUbE5+ZNWeoi+gE=; b=iOf9Fyex6IKbfhd6bKugol/vE4ktLyqYhl+pKGiiV5G05lTEJA6btP+5iy5Opq6qx1 2HDxpy2ukaoDVDX/Or08iQrE3j6sT4Q/LGirt/myXOz5Ig9AxG8MJBcG0tEj7+mKHgui tQZ4tFe2I/OjVPi9fbnOZ3TWTiQQRwtTcBgkNXykBKzTsgnWBp/gbtTrF5UxOE1ai40G 2672RhmjjBrc14Vi0hqdIoi3zVZJqypkvaMtTpzwwxOI+qFdTn0c+u3J6Os4MwikXIZb uu1jC7yPh0x77Wr5M6mQ1S+kNNrF+dw5r3H+/SAng7lIvBHVAXgCIjaroDIleH+3Lorr tdIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731355966; x=1731960766; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eH/IK9UETBwIzrJMbjxMVLpsFzyanUbE5+ZNWeoi+gE=; b=WqOw3FmYHEmKVH12I+pEJOF1pvdLGslY8Ff6hzU+HkDiz9VsNJTBwGLzUJxtn4zeQr UufIttDv9CKsO7SeJtnruk1WqyQES3a1UzWXDX2wrvcV3VdeJ5qUxFoyx01OBT+M53TJ tNAb7+0RYICH2bitx9nfbyhzYDf/6vvnvY/2PSknN8TwsMrW7ak9lX/XIjoj2ocjRvpD jaCRBcgftx2N6FLlGGddqZ5shuxbjXdj8rPg/LV02HV1wx/cyciLhChwKWdX4S4/3sgU mMG0n7e3IwtOhp7WhngPB7tJr42TfU5IHdA4Mks7xr4auwAblO1VwFVzTxsw+GEe53CV iqIg== X-Forwarded-Encrypted: i=1; AJvYcCVCAzUHZjdEnaZ6MidJ+bUvDbSDCp2CnUhnQBbu+8akfycSCq89sEuHl2FMOVKXEtO8ZJ6iodBaEtBhSQ25@lists.postgresql.org X-Gm-Message-State: AOJu0Yytd9RV0W5AagGP+dDkdJpTqyTXnaO+RFZ+FX+Lfr/XWGFw/f3x acxgc7Rs/WNIaCOC2LPOaq5QS9rV004WAID5eH8AmTyXrJGTTiGstpsoPgybFgSggmqIaHJSwfV NBsvz/e3yI1buWUnj4y8DMcUVGSOrrFVGBNnJcg== X-Google-Smtp-Source: AGHT+IEenddPMtAdICZSONyQFvIfHdmYEwckdcbUsLMXHAK6tIJCdOdLk2V5RqxDzPpucpUFJnDccYQgY/N/k6jfyy0= X-Received: by 2002:a05:6000:1548:b0:381:eb8a:7ddd with SMTP id ffacd0b85a97d-381f1866989mr12166171f8f.15.1731355966097; Mon, 11 Nov 2024 12:12:46 -0800 (PST) MIME-Version: 1.0 References: <4f5f16ef-df1e-4e09-9b3f-2e0961ab5117@enterprisedb.com> <20240215201337.7amzw3hpvng7wphb@awork3.anarazel.de> <48d3ff87-a435-488f-b803-258dab6485d6@enterprisedb.com> <6761860c-c66e-400a-b45f-aa741f548771@vondra.me> <8b58ae08-9ed7-43aa-92b0-1976ea6385ed@vondra.me> <225323b8-2c93-4784-8616-c58931a776bc@vondra.me> In-Reply-To: From: Peter Geoghegan Date: Mon, 11 Nov 2024 15:12:20 -0500 Message-ID: Subject: Re: index prefetching To: Robert Haas Cc: Tomas Vondra , Andres Freund , Melanie Plageman , PostgreSQL Hackers , Georgios , Thomas Munro , Konstantin Knizhnik , Dilip Kumar Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Nov 11, 2024 at 2:00=E2=80=AFPM Peter Geoghegan wrote: > The real sign that what I said is generally true of index AMs is that > you'll see so few calls to > LockBufferForCleanup/ConditionalLockBufferForCleanup. Only hash calls > ConditionalLockBufferForCleanup at all (which I find a bit weird). > Both GiST and SP-GiST call neither functions -- even during VACUUM. So > GiST and SP-GiST make clear that index AMs (that support only MVCC > snapshot scans) can easily get by without any use of cleanup locks > (and with no externally significant use of buffer pins). Actually, I'm pretty sure that it's wrong for GiST VACUUM to not acquire a full cleanup lock (which used to be called a super-exclusive lock in index AM contexts), as I went into some years ago: https://www.postgresql.org/message-id/flat/CAH2-Wz%3DPqOziyRSrnN5jAtfXWXY7-= BJcHz9S355LH8Dt%3D5qxWQ%40mail.gmail.com I plan on playing around with injection points soon. I might try my hand at proving that GiST VACUUM needs to do more here to avoid breaking concurrent GiST index-only scans. Issues such as this are why I place so much emphasis on formalizing all the rules around TID recycling and dropping pins with index scans. I think that we're still a bit sloppy about things in this area. --=20 Peter Geoghegan