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 1vfg1T-0041Ow-2X for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jan 2026 15:09:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vfg1S-005Ojs-2z for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jan 2026 15:09:31 +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.96) (envelope-from ) id 1vfg1S-005Ojk-21 for pgsql-hackers@lists.postgresql.org; Tue, 13 Jan 2026 15:09:30 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vfg1Q-000FAE-1o for pgsql-hackers@lists.postgresql.org; Tue, 13 Jan 2026 15:09:30 +0000 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-64b92abe63aso15941320a12.0 for ; Tue, 13 Jan 2026 07:09:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768316968; x=1768921768; 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=HopvI+XNE8cU3Jnhud30XUKHgXQzoNAJXRgLyK3a4c4=; b=f71vj1iyh7R/R3ZuC0rMSffF4volDDFUWfoa8ORQz3ev8myY4Rv84MwGWbPvKSuOpC gch8f7LSlONb0fvvcq7OmQGEISx64x03oZS/BqtA0ArcAQxMOC99DB+YrYGc8v0lkC1X 99nNVLNXe27IGnk+BrsDpHECNsMx0PVpaTacHojA4uxEj+8NIH6O9VIocr1UsFN3zVlL 3mKrWuZ9mR0nK/y+XmaE7C/WiVJdisp/31/+47qv/E7Z612kvW5rPLCf47ysymEaH9TD oxfo6Srd+Dsir68m0el69GWoz3Em8kkZ5rnWUDtnJZmcaxuyZYg+EbeScuf/lxSxGMGe nsTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768316968; x=1768921768; 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=HopvI+XNE8cU3Jnhud30XUKHgXQzoNAJXRgLyK3a4c4=; b=tP7i0SN1jQusJxd6OOojyMhaBfBUBnRy52A0J+2TLakZ5K9q9c8lrybYOFzl7Bwatf LVBsxNvIyYPIxWpwcFiRL9GHEQpOWYtp2Rs9UD4bYI7tHwVvxmBCOW197C4NKTHkjsie QraJWNfFnir2+oHTNrSlLsoBEgzF4LMPJmaFR3bcsL9sll92W1bHr99VAfDkuqKtWvzo gIe+oQ0E5eq8+MvY4TAejGfjctquwUsAg9yGkMasxBgxmXdtKxexFl3k+DEnY0SKhxZM GMDDYULe1+FO2wYocy721iXrU7Qv65pzZAjiNywkwHQX0HKADinsQ/DAbEPQbl4x27kc nAPA== X-Forwarded-Encrypted: i=1; AJvYcCVZFCOy21xUkfFXwpKFihYyUaPtlpsqQZbsg/eG4USXnY5gQVdVpfKFueKruX+InrrwGod6QQJk9oPC0mn8@lists.postgresql.org X-Gm-Message-State: AOJu0YxOKRiH9ZBD5A3airM1KpxwpuNCgv7U/luF90NpEolzRKnONwmx MNs35exlBkPh2I4V/txYAqHV0NxJ2hByY5XV7avIAiOsmh8xMxhA/G2znppfnlgUM8mEaztRkFW BK89gYBNsKCiwsOwmS2+JZ6UxTZitO0Q= X-Gm-Gg: AY/fxX5TVyEjx1TK2uTcl4jBN2e1hPawuB1YV49/ZSBbnKq5oJUKMrn/gCj8xf9PRI7 CYU6uSs4MESa0ERB5yXLgheUbfBKX1DCcgzNjgq+1/SV3N9YYVv0MBtx3FltRrUNmbo/m6KK+5Q Clsjt4A/RD5Ca7DvUTwSPaDXi2s2S9ZkXlecdvuxNTZzWZbV/Je5knWj5KdEz5HIwV2v+OddAi2 N12Ol8xVs6BZP89Ru0hrh2DNPng4nYvyHyQ6kQkNnvygImkOyFnBpFoxhUjtKgvwePdofMIKLlI QA1q1A00j0B0IWTRmS9eKi+//o4t X-Google-Smtp-Source: AGHT+IHPrVD4Tc8rfQa3S2mrIFdlAwJP8v4zdED3+a1NCKvrpZcsN9e0rvF8V7JfFSwKudIWgnt+g/6F3KnOV/EC/WE= X-Received: by 2002:a17:907:a088:b0:b87:173f:626 with SMTP id a640c23a62f3a-b87173f2b44mr625865566b.8.1768316967393; Tue, 13 Jan 2026 07:09:27 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Robert Haas Date: Tue, 13 Jan 2026 10:09:14 -0500 X-Gm-Features: AZwV_QgEDA3e64VtlQ4axHJ2tAlEYmx0RaIXXteUNdzQFS1LW8Eud1Wjb7XWIdo Message-ID: Subject: Re: pg_plan_advice To: John Naylor Cc: Lukas Fittl , Jacob Champion , 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 On Tue, Jan 13, 2026 at 6:39=E2=80=AFAM John Naylor wrote: > It looks like it would be helpful if fasthash_accum_cstring just > returned zero when given a NULL string, as in the attached. We could > also do something like add a large number to the hash, but I'm not > sure that's necessary. I think that pg_plan_advice's requirement are unusual here, so I would suggest not adding a branch to fasthash_accum_cstring. If this were a requirement that almost every caller had, then it would make sense to pay the cost in the common function. But there will probably be a small performance cost to this, hash function are often called in hot paths, and pg_plan_advice is, I think, unusual, so I don't really like doing it given thoe facts. > + /* > + * hashfn_unstable.h recommends using string length as tweak. It's not > + * clear to me what to do if there are multiple strings, so for now I'm > + * just using the total of all of the lengths. > + */ > + return fasthash_final32(&hs, sp_len); > > Sounds reasonable, so the patch also documents that. Some kind of comment change here seems useful to me. I wonder whether it should be generalized even more than this statement. I also wonder if this is really the optimal strategy. But I definitely agree that clarifying this in whatever way makes sense is a good idea. --=20 Robert Haas EDB: http://www.enterprisedb.com