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.96) (envelope-from ) id 1vSmNh-005Wdu-2J for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Dec 2025 01:19:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vSmNe-0029d2-10 for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Dec 2025 01:19:06 +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.96) (envelope-from ) id 1vSmNe-0029cu-01 for pgsql-hackers@lists.postgresql.org; Tue, 09 Dec 2025 01:19:06 +0000 Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vSmNa-003qcO-12 for pgsql-hackers@lists.postgresql.org; Tue, 09 Dec 2025 01:19:04 +0000 Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-8b144ec3aa8so439139685a.2 for ; Mon, 08 Dec 2025 17:19:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1765243141; x=1765847941; 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=cZ6GnQJNrS4/hTI1cn0jvI8L92r1wWfh0Aok6wuAvuE=; b=h42cOhHV8lBFtnQc8wn8d8WvC7oT0ebBm4ACLP33INeSQimhrjLAkljK58Yh00wbyV sJLTOnp0XtaNRNgLeYkjwNtjYOmj9iYm2RC4rpF3DWzxV26ibsfZxj83rRroflIKgwhV Ia97nRD3m8UnNmVA/VCPIfDleTUnT/Nyvc/jirn+wS2KJYocMB6xAeL0R/d7HGSg7n+Z M8O0iEmI2k4af1YOdKW703iSB+u9JKUdF3rHZ53ZHFZTwqhPP3I+Kgy7HYqWWa8o7XS7 OBlYVQUyzFE6tLbnUKQHcRgkE2Ws5PgiFO07kfA+7edNPjPC0xdfD2pGMp6CR0S0Q0B6 vDKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765243141; x=1765847941; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=cZ6GnQJNrS4/hTI1cn0jvI8L92r1wWfh0Aok6wuAvuE=; b=G3nmmKht0Tm7QPyHzW7mZ9uN9wJikkVR0XI/btPLwU+P+SnddNvTwp1o/4VFlzup13 qUV1D5W3krbrNfcY9CWN5Rt+gKVma7Pltn2tPbfM1bgFu1iQNdhfv8hsIdg4LcaXX1TC GEk5CV1d3hLMjwMa/AUBxSNdTZIW3Jt5af5XxBLpoKoGw9rAQ3inUH099D5j/TT3bqMY c6BA5BnzNoUTCzPHt1ryar57wsdK6yg0ulL5oGjMQEo6goNQ1/nXyDsOroik0IZe10ET 0x4lEmSKMCZkQO43MoysHBUakwSOqn/uVrGOJosfOe7KgMENl0JGT8gFTCgBTjyWLSW/ 59Tw== X-Forwarded-Encrypted: i=1; AJvYcCW4E+pd7B04DZFcT+vXDgAFZfjLDemm/+Q4rBmtjbS353jmGPS0i6WoI3d1H3EA388pVf/RydIZ1FK2/op+@lists.postgresql.org X-Gm-Message-State: AOJu0YwnwLzzJpQSuejIx8znwbcUxegHbSk4uMabBm7rKbW+judAmkgL JLQcy6BI0+s4YiLMK4MVfiUOtUtD4socQtyw6/P7aUkuVs2CzBR/Uf/gOKH2dSfwUmgJ0wTRChd KaCx7N1FaZoYYyr6a14ZgyY/PZ2flQPuMa/LYlIXf X-Gm-Gg: ASbGnctlrmY/VYvGhxt4neu/zdgI2ntrNGWDnTwmtXWX6YK+2IJGMDFPrzBFTLGXeI3 IZnTwEojTcCdk1tBqdcD/wGkP3jqTunjaM9I9DGP7c8xYtJTizA6aslKIzm20IrTPnkPRCfgN61 EsErburs1aMBqPIbYDOpWCcCazdRH8V9w7iAeHcvz6BE1x5n6cs8ZLBAES+pij57GIFAEovrmrN aAUtiZ09m9OCKk85KFKr8T4T4aXgXkw+6Jv8Qr90Q1Bc1n6cfsqX2zIzYGfhDv/a1QhicE2+Q== X-Google-Smtp-Source: AGHT+IF7m5mUs922qwo2wOj7iVdDZ4Ae14KicOkW/PQCImTUpnr8oZn/txdSGBlF00rmCJRj4bWOmoNKXh4LJhDPopc= X-Received: by 2002:a05:620a:4511:b0:8b5:1b5:cafc with SMTP id af79cd13be357-8b6a253eb9emr1389982885a.36.1765243141379; Mon, 08 Dec 2025 17:19:01 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jacob Champion Date: Mon, 8 Dec 2025 17:18:50 -0800 X-Gm-Features: AQt7F2qXGkUWc8fmPHO6N_Hwv20wlPDYCfM1ABEE9f5cJz_Imy_83iVNvNXdRnE Message-ID: Subject: Re: pg_plan_advice To: Robert Haas Cc: Dian Fay , Matheus Alcantara , Jakub Wartak , 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 Hello, On Fri, Dec 5, 2025 at 11:57=E2=80=AFAM Robert Haas = wrote: > 014f9a831a320666bf2195949f41710f970c54ad removes the need for what was > previously 0004, so here is a new patch series with that dropped, to > avoid confusing cfbot or human reviewers. I really like this idea! Telling the planner, "if you need to make a decision for [this thing], choose [this way]," seems to be a really nice way of sidestepping many of the concerns with "user control". I've started an attempt to throw a fuzzer at this, because I'm pretty useless when it comes to planner/optimizer review. I don't really know what the overall fuzzing strategy is going to be, given the multiple complicated inputs that have to be constructed and somehow correlated with each other, but I'll try to start small and expand: a) fuzz the parser first, because it's easy and we can get interesting inpu= ts b) fuzz the AST utilities, seeded with "successful" corpus members from a) c) stare really hard at the corpus of b) and figure out how to usefully mutate a PlannedStmt with it d) use c) to fuzz pgpa_plan_walker, then pgpa_output_advice, then...? I'm in the middle of an implementation of b) now, and it noticed the following code (which probably bodes well for the fuzzer itself!): > if (rid->partnsp =3D=3D NULL) > result =3D psprintf("%s/%s", result, > quote_identifier(rid->partnsp)); I assume that should be quote_identifier(rid->partrel)? =3D Other Notes =3D GCC 11 complains about the following code in pgpa_collect_advice(): > dsa_area *area =3D pg_plan_advice_dsa_area(); > dsa_pointer ca_pointer; > > pgpa_make_collected_advice(userid, dbid, queryId, now, > query_string, advice_string, area, > &ca_pointer); > pgpa_store_shared_advice(ca_pointer); It doesn't know that area is guaranteed to be non-NULL, so it can't prove that ca_pointer is initialized. (GCC also complains about unique_nonjoin_rtekind() not initializing the rtekind, but I think that's because of a bug [1].) --Jacob [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107838