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 1vGFZH-00Ar2f-QB for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Nov 2025 11:51:19 +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 1vGFZG-00DJy3-G6 for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Nov 2025 11:51:17 +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 1vGFW9-00DGkA-2H for pgsql-hackers@lists.postgresql.org; Tue, 04 Nov 2025 11:48:04 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vGFW5-005vJE-2i for pgsql-hackers@lists.postgresql.org; Tue, 04 Nov 2025 11:48:03 +0000 Received: by mail-qk1-x743.google.com with SMTP id af79cd13be357-8b19f149933so32130985a.0 for ; Tue, 04 Nov 2025 03:48:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762256880; x=1762861680; 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=yWeAebZsXspSK7fWgicqIwkarYcYu3g92Y8gDGROpKE=; b=iY+tWnr3qDx4rNYhPjmZJVOcCiasbEVXeN9KLq02j6/T4+IEparOB0AMkjJ+j2NZ6L GWuI39+TJVw6ajZmxm7Tyvi4w1CTpy3GWdcfgxCAvzj2gM9p235mVC6k3JjC0AKu63yT IhE+yj87etkXh8wT7IDurHxN25ktYbjg7voGsa99OI5N9sKVsW4AbKbYJlYorya4w1VR S0+H83sohvD13qmf0bhV8ZzhaHKBhjuRoxvJf1gso41feya0M2SaErzQM7d67dRjA7Y2 pE919aGokpfBk8mZDwvpEehFic0jxf5vL/axxrSQvLb2fu34k+qCOtHtXIPokuLpDteX bASA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762256880; x=1762861680; 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=yWeAebZsXspSK7fWgicqIwkarYcYu3g92Y8gDGROpKE=; b=fo72KWaoPGDXsbMIDdxprkSQW8Ws8sVMSr//Y1fdMFH1bv2oMHknV56VC1zOZCYbgd YqFN7rpSU94TQyIBP/K2ZfXRJ0qqBIR4rMcxFwqNp6M1s4irNUEDds3fGZrxgh2Oe0Qg rE7p+SJnfmx+jYwR68tNdK+4a0CONutLFS+x83YCLzRWcKVC36UoSfe30B6jAzDo3400 6wiGIMh3N0lk6m0e1jd+6LroFeEE/Cdb9BY+hTaJGN0qv3hukrrPmf7cr/7Cu10KuYhl QG3VQPWcooACdo0HEGwGur0zlfCoiqbJhv5GsFMbh3bKbdTENWXSq47xsmW0l7LMNrUJ SImQ== X-Gm-Message-State: AOJu0Yynw0oonQsguQA7mV7hZy1y8oYsHIAyZgU3opPkUXub8YJkKiMZ EoCd+CdPcFhK+GqkdxhA2ihK2Fd/u6OS18TojeP0/nGmZpOE7TbtzCOw5fp4l/etidgyaN1A6fB ylvaGMGfhj1bFS5hF7KsFTuHSytgg5Y4= X-Gm-Gg: ASbGncstQI7VXRxb34PyzN3xpdC5o//ga9M4ikPm2xRZNMHqFlr7b1px50n+f7uu7Y1 GzjA+JsZ6DH4MZtzzIKTeLo+w+Pk53VUtB8+tyesSjn8fGjG6ZM6pMckWj64Qf6G0xbCxN5FR0N oVXxKI0gtgj7f6bVzIeIoZXNSAikEh+e4diundJsQmNGXD51Rg2hjxaU1Mo19mOc2lAiMA3dRYk My4zM/XqXidKQ6McAlxXwK2rERipQs6bMAX5lJEcgobeWRhlb2WoxoVNLLhYZauk3jKE0fXwCpx 6o7+rzt+/Mqf1+VqNf3hpSaxupSBwCJAf3QkuOdmEeISL7A= X-Google-Smtp-Source: AGHT+IFSqs89bdnEnGeQhrCk8C4o7R2IHfqQJuPRrTTa5mr0sVGCuV3Vtp6W7YH1VJSdOm+U4PPDQts41pwazEbEfrA= X-Received: by 2002:a05:620a:3713:b0:8a4:19a:dd5c with SMTP id af79cd13be357-8ab98fb4f15mr2017703085a.1.1762256879497; Tue, 04 Nov 2025 03:47:59 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: John Naylor Date: Tue, 4 Nov 2025 18:47:48 +0700 X-Gm-Features: AWmQ_bk2dA9s7bikU9vy48x_HrG_8jb3zoiyLYDv9Z_cVQA8c1TSwekyPRFu2P8 Message-ID: Subject: Re: pg_plan_advice To: Robert Haas Cc: PostgreSQL Hackers 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 Thu, Oct 30, 2025 at 9:00=E2=80=AFPM Robert Haas = wrote: > First, any form of user control over the > planner tends to be a lightning rod for criticism around here. I've > come to believe that's the wrong way of thinking about it: we can want > to improve the planner over the long term and *also* want to have > tools available to work around problems with it in the short term. The most frustrating real-world incidents I've had were in the course of customers planning a major version upgrade, or worse, after upgrading and finding that a 5 minute query now takes 5 hours. I mention this to emphasize that workarounds will be needed also to deal with rare unintended effects that arise from our very attempts to improve the planner. > Further, we should not imagine that we're going to solve problems that > have stumped other successful database projects any time in the > foreseeable future; no product will ever get 100% of cases right, and > you don't need to get to very obscure cases before other products > throw up their hands just as we do. Right. > it seems to be super-useful for testing. We have > a lot of regression test cases that try to coerce the planner to do a > particular thing by manipulating enable_* GUCs, and I've spent a lot > of time trying to do similar things by hand, either for regression > test coverage or just private testing. This facility, even with all of > the bugs and limitations that it currently has, is exponentially more > powerful than frobbing enable_* GUCs. Once you get the hang of the > advice mini-language, you can very quickly experiment with all sorts > of plan shapes in ways that are currently very hard to do, and thereby > find out how expensive the planner thinks those things are and which > ones it thinks are even legal. So I see this as not only something > that people might find useful for in production deployments, but also > something that can potentially be really useful to advance PostgreSQL > development. That sounds very useful as well. -- John Naylor Amazon Web Services