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 1suB6A-004oFU-93 for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Sep 2024 13:33:30 +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 1suB69-009PUv-AJ for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Sep 2024 13:33:29 +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 1suB69-009PUm-17 for pgsql-hackers@lists.postgresql.org; Fri, 27 Sep 2024 13:33:29 +0000 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1suB66-001KFp-HU for pgsql-hackers@postgresql.org; Fri, 27 Sep 2024 13:33:27 +0000 Received: by mail-qv1-xf2b.google.com with SMTP id 6a1803df08f44-6cb321145easo15305916d6.1 for ; Fri, 27 Sep 2024 06:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727444005; x=1728048805; darn=postgresql.org; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=rnEHkF00AX+j2FpuSwYO4S28+xezPOWHgvQ0osIJhZc=; b=BC2vXbY31V/wktEt5RCDEmULzuwUEBAueHMeaPAG4S/izfZSOQRnw6+Rl5x6SpNaXU tgVI/Ud21Q8A1wwhHadxvC0vKi1Z/DL6BcT0pCAOPs2aLPLhIzBgMS8CWQwrR/v/wZke lbRicsxd4xABFxacpKYeNeMX8ds6rtGJI+0lbuPhWcBtRyjAH7MCamlFt647/lVdXyrz 6lqVzxXrvmOxIUelSwWKQ1WuNXvFAZqIYZr201rVytaPlQEeCQAlfRUJUCEphnYhtEY0 xxirRn99JPDPH6U+zTf0K/VicGWohONYZ/4XRau1LoLc39GZDP/UUgpKc8ZT4Vrov59R c7wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727444005; x=1728048805; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rnEHkF00AX+j2FpuSwYO4S28+xezPOWHgvQ0osIJhZc=; b=R5HPlmEGGE8otnuzl7d3Pq6VWGlZ72tRTOo5uIaE9urWF0ujDuImOocDpt1JFP/nhy 8gfjhTQjEpkpG87lWTmAQqT1DaGjcLXqWKsoQnRGhb3X76+PLlfBYvqf6eucyjJDW7q7 Pob3PoYmtrwlV+OTf4SvnTtr5p7FbtfVvKuRQlH2arjJt8sBcJ2bXxNRiXChVggBNwL7 531p3gF7yXRWaHA2OsDAb01lvvnd24v2QCPfmMU+X66CKSp3d5HBbW7NW1iT3IfSKTIj 32DZOrwnCfa5KQhE1k1skz981xKn532ASlY42yPD1Izr0WqAYWetaXEh/ww2qLCBQdIj HA+Q== X-Gm-Message-State: AOJu0Yz/fhouQ+PCZINg2GMRlY6vXKa+zsNAA4TEPv1N0dcsSImStOCR 7ne/m01qNtRscjOzbOiQPDAJqoB9WrcRLXNVIpuqrhzh6//RGYByipNscw== X-Google-Smtp-Source: AGHT+IHI0jusQHckowcy+gJ5JLH6g3OMCPRmn6Q5MQA8rJg8FDTZ5nBFGMiL4noJDpmaGp1/tI/x+w== X-Received: by 2002:a05:6214:3c85:b0:6c5:944f:ea5a with SMTP id 6a1803df08f44-6cb3b386d70mr55524126d6.13.1727444005080; Fri, 27 Sep 2024 06:33:25 -0700 (PDT) Received: from smtpclient.apple ([152.117.96.208]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6cb3b5ff5adsm8961576d6.23.2024.09.27.06.33.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Sep 2024 06:33:24 -0700 (PDT) From: Eric Ridge Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: IndexAccessMethod API & Index Only Scans Message-Id: <63F9F123-F5ED-4B2C-BA09-12E22B36870D@gmail.com> Date: Fri, 27 Sep 2024 09:33:13 -0400 To: pgsql-hackers@postgresql.org X-Mailer: Apple Mail (2.3776.700.51) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi all! Congrats on releasing v17! I'm adding support for Index Only Scans to a custom IAM impl and I've = got a little dilemma. =20 My IAM implementation is essentially a composite index that might have = up to 32 columns and while it can return any column in the index = definition it's quite expensive to do so. It doesn't have an already = formed index tuple sitting right there like the built-in btree index = does. Returning 1 or 2 columns is usually a win over the regular Index = Scan version, but more than that and it's at least a wash if not a total = loss. Since not all Index Only Scans need *all* the columns, was there ever = any thought around providing the required attnos as a field on = IndexScanDescData? That information seems to be there in the = nodeindexonlyscan.c machinery. As a compromise, I've settled on my `amcanreturn` function saying it = only knows how to return attno=3D=3D1, which is sufficient for some = query patterns, but I'd like to be able to have my index directly feed = tuples into aggregate plans and such too. It's just too expensive for = me to always return all the columns when generally maybe only 1 or 2 are = needed (there doesn't seem to be a way to weave that into the cost = estimations, but that wouldn't matter if I knew which specific columns I = need to fetch out of my index). I'm pretty familiar with the IAM and the internals around it, but maybe = I've missed something -- can I get at this information some other way? Thanks for your time and consideration! eric=