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 1vFEBQ-009QAR-BZ for pgsql-hackers@arkaria.postgresql.org; Sat, 01 Nov 2025 16:10:27 +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 1vFEBO-0061Ra-Aa for pgsql-hackers@arkaria.postgresql.org; Sat, 01 Nov 2025 16:10:25 +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 1vFEBN-0061RS-Ue for pgsql-hackers@lists.postgresql.org; Sat, 01 Nov 2025 16:10:25 +0000 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vFEBK-005RGk-1d for pgsql-hackers@lists.postgresql.org; Sat, 01 Nov 2025 16:10:24 +0000 Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-4eccff716f4so263401cf.0 for ; Sat, 01 Nov 2025 09:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1762013421; x=1762618221; 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=rsCjKRWxw5Ib2cTIvKncfn49Z8T5FNtP4BpuCP1pGu8=; b=vD1FCdUfRqY7SAdCtF5XeEqbJNtbykOl05CbmDrjWTyXs9e/5d7bmL13iFEj+JMqSw 8pNv6sbWWSJRlLSMClTBLks96eYclIKhZ3sEKsc4FYBW+fNoHOHPsQMaReqnziAP6nl6 Av+OmpmHfuVa/cePKv49dQ5VMjL37ZV9O9fOYBr5Te1rDDk1MGOVVyHGe4MGKs4NbVL1 ifNpSmlIY9wTDz0OOxfoGt0ft7HFOHmldejwwojP9nL4NfpKW+I3T9OQiKdy/dMC51WI sjcxqSxXQtw/Vhoh2G3aOiXOkL9kdg3xY3ku+mi48FCjVzPdT/x89Jd3lixv2B4qejnh dEqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762013421; x=1762618221; 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=rsCjKRWxw5Ib2cTIvKncfn49Z8T5FNtP4BpuCP1pGu8=; b=hPeoOGLElOR+tFFvNBGJ3J2cBbFvS9VzWb3zXzCz3bwqWN8G9IyNQLf+PNYuCyXnlM PGdG4b7HPQlcylNYf6rN2CNYbFx6qWeiJnfuzCjqEa+T1gfhr5Y80euK36O8X3KayDTh W1em7GzzIEauWRe/MXL0TaDH8KB9/yEG0sslXfU0TKayPxBaXBF9JC2TgWdSAGtieY5y wWVIXK9lFjvrhKxshKZ6Ix7BEsvLQrGqZ84VKVb4/zskMIQIkluXaj2OcH1gejgA+Tnd QljoMqy0HKEe82Yrfz4Rw3CrFCt8l2aoVHCBy4fk5EMi8aNDHnHqrfBDw7MZeHYTUhj5 LsvA== X-Forwarded-Encrypted: i=1; AJvYcCXSyQ1b/l5eemtglYRoYgE+iCwESvkGEKufToEU0dhoVJOX08Q9IZz/VKiWUd0jMrZM43DQxISibbzpm2QR@lists.postgresql.org X-Gm-Message-State: AOJu0YwcIwY9B9y4j/zk5hxVlHVdGGKdBqgQFmtl/W/Ma2DbY4CV+Mju VPPZyGPoK9PGgIecMBaadyjFEyol4HxZFE0Il4L3uDDjjO3NNgq2Tu+5kI53+3syQqFhN8Yg1Zw KJYYWik/40zjHdNGAqwLljn79LkQNoi/P+ZDC92Vr X-Gm-Gg: ASbGncsV+FmCUaKZq/yT1c0pamK1kx3t7ANHz8854/v2IlRjREXp1yPF8DCISrTZmqQ wcStwcRqIJtDCNtm8WFwdz2gZVehP3LHuz1m00quQLFUDb9gwixYPZZeXPU+1TEpuZf3LFL38jw sweCYb4Axk/QFMg9tL8U3cJdHH8y1t7DpR9Cnvk50UaL20VwOO4j+zmI2+zuUfAfG5vD/u5lPgX bQ70tW0HtdwX+zD0UA6qWRdeOu+Uosku4uXKnoNhnuS6/C2oFFt3mcDi58sNoeFU5KzBug= X-Google-Smtp-Source: AGHT+IFtTZ04fBSDRKO5yPrXLtVcoALme8a92KEHkSz0X4by+ldwgPfqbn8SrIJx9dhN+UkBrm8xVXEMS5/+UQqI51Y= X-Received: by 2002:a05:622a:295:b0:4e8:85ac:f7a7 with SMTP id d75a77b69052e-4ed424b9c63mr4040141cf.9.1762013420540; Sat, 01 Nov 2025 09:10:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Hannu Krosing Date: Sat, 1 Nov 2025 17:10:08 +0100 X-Gm-Features: AWmQ_bmvx03X545Vy56Upr5qB1exG2U5yeC8JAqT8e1eKLLvHWwniEMPH5-cVnY Message-ID: Subject: Re: pg_plan_advice To: Robert Haas Cc: Jakub Wartak , Alastair Turner , 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 This weas recently shared in LinkedIn https://www.vldb.org/pvldb/vol18/p5126-bress.pdf For example it says that 31% of all queries are metadata queries, 78% have LIMIT, 20% of queries have 10+ joins, with 0.52% exceeding 100 joins. , 12% of expressions have depths between 11-100 levels, some exceeding 100. These deeply nested conditions create optimization challenges benchmarks don't capture.etc. This reinforces my belief thet we either should have some kind of two-level optimization, where most queries are handled quickly but with something to trigger a more elaborate optimisation and investigation workflow. Or alternatively we could just have an extra layer before the query is sent to the database which deals with unwinding the product of excessively stupid query generators (usually, but not always, some BI tools :) ) On Fri, Oct 31, 2025 at 10:18=E2=80=AFPM Alastair Turner wrote: > > > On Fri, 31 Oct 2025, 12:51 Robert Haas, wrote: >> >> On Fri, Oct 31, 2025 at 5:59=E2=80=AFAM Jakub Wartak >> wrote: >> > > First, any form of user control over the planner tends to be a light= ning rod for criticism around here. >> > >> > I do not know where this is coming from, but everybody I've talked to >> > was saying this is needed to handle real enterprise databases and >> > applications. I just really love it, how one could precisely adjust >> > the plan with this even with the presence of heavy aliasing: > > > I really like the functionality of the current patch as well, even though= I am suspicious of user control over the planner. By giving concise, preci= se control over a plan, this allows people who believe they can out-plan th= e planner to test their alternative, and possibly fail. > > Whatever other UIs and integrations you build as you develop this towards= you goal, please keep what's currently there user accessible. Not only for= testing code, but also for testing users' belief that they know better. > > Alastair