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 1uzCs9-000jfy-RW for pgsql-performance@arkaria.postgresql.org; Thu, 18 Sep 2025 11:32:21 +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 1uzCs7-00FeOg-5q for pgsql-performance@arkaria.postgresql.org; Thu, 18 Sep 2025 11:32:19 +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 1uzCs6-00FeOY-QE for pgsql-performance@lists.postgresql.org; Thu, 18 Sep 2025 11:32:18 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uzCs4-001555-16 for pgsql-performance@lists.postgresql.org; Thu, 18 Sep 2025 11:32:17 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-3601f884888so6524021fa.2 for ; Thu, 18 Sep 2025 04:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758195135; x=1758799935; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=WU2hXiFoX2kK5fs2eOzsdmyYjP5zFSzJfFzIfjfhTM0=; b=CwWQTOW/L2cMXBZBbMrxmbbYc8xUgoq0CAktDuuJd/snWThu2ejEzBy77d6Ad13xlo GCmb4HZTgSYGEE4K29A4KR7aOZkiuM1x9V1fiwDf84PzFcrt8bDcohyUCuEMi2y3detm i4iFllXBrLXFzAqI7Yb/IAy2nhw2NqU8XIP/y4CT71M8WV74Z0nu9Mji69FcGN8xihtY 2o3gRmsaNa55PGAAisE+UevEDsbz6/n9mVexQFb+Qyib03xZwA8ANZZkasoXMqn0jqoB W+y4GVQPacquv8UWf3cQYTffS4Lmu58/nio+wJ3vtebHLWEoLuNf3tPOQ6xseNtyi6Zd RKWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758195135; x=1758799935; h=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=WU2hXiFoX2kK5fs2eOzsdmyYjP5zFSzJfFzIfjfhTM0=; b=s7ypdCakZU2ATQ6z1Y5qJ62qgEKkoJsYo+kvu05HMkBhmgUpNWa9zQn7fZteTsPDTp awvmKtjEgblg9WaFtcJUM5GNFb+D4SDtzeL7JTUP9WbjhUIRnSdUFHVFEvqyW1uPm7BE 1QziZNvYllbZyKIovB8F+zOMMGCaL+l8xloALUfPnn2/PBk1n+uiUda2POe96Ajt/d9P EQfH4vEC7HpAfD5/+si7KuAdt0mZtElY8eRzz2FW2Wgd3HSRSFmsy+dDBvWGgVaiafvS AhJPNBBE8aSgcOzh4VXGVbkoAFsU6IvkpwVHgdw6gp+MnFZ9p2HVvepLVdiMiQ+VEFEa ow9A== X-Gm-Message-State: AOJu0Yzx1+PAPks8VNe11Auh263sgzRTpG/Jp47+NUOXfixUE/o/kVm6 0y1Xb1ogGoCvqWmfvDD+nBgwqkYD3W3XDNQMj/nWHaxpaynWJ2enQzf0odx+XXq3YoCCj6qZ5Az a5s+PIfKrjBBuEezyFWoWpAR4U1Arb22wBy3t X-Gm-Gg: ASbGnctYXB18e1sjMCcnIlRMmkghUELi9ZwcD5geEJP39cPobP9EmH5e58q7i1tVotV TEHLvIFCd4oHiX7ly/z1lVAJ4YYbG9DDPjHydEGRJV/ajZH+UROnNVc37hOwkvMHd9xWUkGqMol ujwmit++a2ECeKMbsbNjdWAmKGTR3QokO0SASRkxipSRkadqFG6H8GB/rUr2EVJeA+emG0Fxd7w FFHOK4qmnUXs4FdMArYodcqiZahWKPWr0a9HRWsd/Gyc5OEZGrJfCcZIl3J X-Google-Smtp-Source: AGHT+IEFcrbMaNNryWnJnCOZnW3JoKjGG0zAkq9Y4n9wKcnBA17Kd/jTyUiR7KJl9Yeu/tpw4smOjUhTg1ucUnkFM4I= X-Received: by 2002:a05:651c:3247:10b0:336:6c93:9726 with SMTP id 38308e7fff4ca-35f6310e17dmr12860191fa.4.1758195134704; Thu, 18 Sep 2025 04:32:14 -0700 (PDT) MIME-Version: 1.0 References: <8f25c08c-acb2-47ca-b8c1-6664fc31a361@thefreecat.org> <63d65775-0130-4c5c-a151-8d7728b6d4e8@thefreecat.org> In-Reply-To: <63d65775-0130-4c5c-a151-8d7728b6d4e8@thefreecat.org> From: David Rowley Date: Thu, 18 Sep 2025 23:32:01 +1200 X-Gm-Features: AS18NWBevPQT7GKbATZRIRibqB8FJ5Cbih9_uJI04ifEgOh24ldUqxdg4k-T6w4 Message-ID: Subject: Re: Why isn't PG using an index-only scan? To: Jean-Christophe BOGGIO Cc: "pgsql-performance@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 18 Sept 2025 at 19:45, Jean-Christophe BOGGIO wrote: > Ok but then why is it doing it on the AD table? Is it because of the > number of rows? It's hard to tell as I don't have a clear view on which columns are from which tables. Perhaps "ad" can Index Only Scan because all of the columns required are in an index but with "oeu" there's a column being used that's not indexed? David