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 1vFxcv-004V2r-DT for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Nov 2025 16:41: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 1vFxcu-00625v-79 for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Nov 2025 16:41:51 +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 1vFxct-00625n-Td for pgsql-hackers@lists.postgresql.org; Mon, 03 Nov 2025 16:41:50 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vFxcq-005FDO-2t for pgsql-hackers@lists.postgresql.org; Mon, 03 Nov 2025 16:41:49 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-b713c7096f9so164676766b.3 for ; Mon, 03 Nov 2025 08:41:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762188107; x=1762792907; 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=sQObBSmzSk8il0b2ynQeNpdkLxBIWqG2EFoL1Qi5Vbc=; b=kh8CwmzUKS+VckjzBjfNS1nqM0d0E5m4gd7mTIn0x4wOYZI3PlIRsixH09G1gpflWH 0K0WpN+aUSZ3RfVuvuZvZ62XBX7UcF4dsai9POspA5Lud9MEHe6EPTTjMFsjMBhckFjU 7+gqtk/0BSlwXJrJiv/mp5W+LQS4pwiqBedPMF5FVWy3ncXjDWtZUD6HgoiP0GtYDJjT vph+zYEPowpq+fp7imHG+cCNXryodjZVlAUnIZqyTwX5sE0onSKP37PfxCn13VcZ0SqN UvmM9/XIMhZOMFKm9XkaUSoOYtWpYiMbwOhYGGLWaYlYDv09w/bSLt+MBlflcDpUGeNo KPUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762188107; x=1762792907; 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=sQObBSmzSk8il0b2ynQeNpdkLxBIWqG2EFoL1Qi5Vbc=; b=c3ccc7kT+Fww4wXO4lFytQ4heza/H+fG7wnf7eNEn/1FjwukD+GqZQ9ol5SzMrD668 xGrHni/QKGqVssLUIMcjHO7dETLqpsH1ow/htamWoQeTOCbwdbJ2fx2wtBbArYxN7gkU 9qbihk+YAcXt/IwHYei7QkoaKZLknOcnFEP4WDWU8pQ7oRGMZHNxc+T8XmBhSGF/KoVW XnakqQTQ2Cv9ilVsBotuSCECMMfGYAoPh8+CyzW1mX6WlsUe84s00tM1WZDw5N79g5NB H0iMtG7lQExFaULz793nsbHkOoRvd9wje507snxnKIzV/LtwHmB/4F7e18tC7wpEu4Zt s5VA== X-Forwarded-Encrypted: i=1; AJvYcCVXdF4FjG2dzYk93ZTg9ibRmKwph6J1auCEB8Q2IRvnWwQq497quCCUwN1VFHl6qj365124P1BEFKjbMZq+@lists.postgresql.org X-Gm-Message-State: AOJu0YwvSN2rtQ2+LapMPfOOkgoIVld9/GKbMfb/Tmc/Su91FzWIYKNK MagWa4zcoiVm9B6cjZkBGAkvZEedNAerEo2wCMNmY2hBQJjA3F8lHckHGwsOzI9wbn7+klL0xgS KDHRhdlFRIME1U4pqCufLcomouQQJVPI= X-Gm-Gg: ASbGnctZGMzcICrtgqUbeltRmwuadd93MFDwzGrHvG/j0P/ZtuwAN41+nHR33aeL4mQ QmXmOchNhA3nZpp+TuqHg2uQftwTVn8Fh8zJaf5MlFOtRPtP4qV/8GNgnmSgGv97RB1XLjS1aDL /as3JwCkuXB27b/sqHOqiM7nyshwmhxhLKN9bkyzZlDu9i1PAxhKqH946VBbkE1Hw3kz8JjZVQk QaKum28orBylxEvyqD8gJnhBpZpO5IzfUU6z/R7U2U/x79dPiLkd9sqbjTKGg== X-Google-Smtp-Source: AGHT+IEKPww3hj9hLzdr/uHZbbWuKIbyVMhxKjnnuxSFGWMLL6WvC5VPpFGYJL//sR0rH+UkWWV3Eq+2WxdBQccp/6s= X-Received: by 2002:a17:907:a088:b0:b04:25ae:6c76 with SMTP id a640c23a62f3a-b707062d5c5mr1150732166b.47.1762188107202; Mon, 03 Nov 2025 08:41:47 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Robert Haas Date: Mon, 3 Nov 2025 11:41:35 -0500 X-Gm-Features: AWmQ_bkoMjaUvRKgD0D8jY0gJRhQpEgviScnw0iTdLf1VoXKqtLjoZDla_o2QEc Message-ID: Subject: Re: pg_plan_advice To: Hannu Krosing 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 On Sat, Nov 1, 2025 at 12:10=E2=80=AFPM Hannu Krosing w= rote: > 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 :) ) I'd like to keep the focus of this thread on the patches that I'm proposing, rather than other ideas for improving the planner. I actually agree with you that at least the first of these things might be a very good idea, but that would be an entirely separate project from these patches, and I feel a lot more qualified to do this project than that one. --=20 Robert Haas EDB: http://www.enterprisedb.com