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 1r48mI-007XFR-2c for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Nov 2023 00:01:38 +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 1r48mG-00Gvm9-Oh for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Nov 2023 00:01:36 +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 1r48mG-00Gvm0-AW for pgsql-hackers@lists.postgresql.org; Sat, 18 Nov 2023 00:01:36 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r48mD-0065bF-LE for pgsql-hackers@postgresql.org; Sat, 18 Nov 2023 00:01:35 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b709048d8eso2366625b3a.2 for ; Fri, 17 Nov 2023 16:01:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1700265693; x=1700870493; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=sU53rZOoW4AlqcAxVsWzq+XXjtmgbeYdVNe0QvF8t7o=; b=VV2pugW2N0VpKRYn6HY+/qljXeltZ0tprdZ9zlkxmxdwkL3Z32NF21iKfpp1dSflkG RVxOZhtDtyBX/q9eKlWlF2vHupaTNkLwARH3YtLDzpfPoOuZy7UpxF94+C4595tIbyjs WLQQm/KqGnlIM9KxwMEHYYGNzDaoErX/QXamUbBQ/fkTfBoxS2x8jpAEAVPji/PTJISY zrDGB+BbP4uCxbM/nZCAOhasBWTDjW5yc7e5fqiWrgC9ktLHrNsthW+W5qwSFa7k9BGL h1aJRohsrifhzn8azEKJXSISoIQItkblvOSrZU4/qvUMPORz+Jr4Kf614cohCYPl6zv+ ZTxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700265693; x=1700870493; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=sU53rZOoW4AlqcAxVsWzq+XXjtmgbeYdVNe0QvF8t7o=; b=WlsCcAZYF9TcNDptHaR9Au1Rhx/4TOFH701COB/T6xFxIGEyqQLVVJ88v63KUmtGvT P3xUBluM73tihdploOFVwSrkmQ4RS4vnuVs70GLl7DOMEKYY2NZ+Va9+PQiKcMmzHt7q ahl/epsZvGGmSCnbf7KrOSjaxkAm+/ZrQWK9W1v2hbqlFoB6rVgIcbtt7LaxQO68UxJS uFMffib8HgTCWMdEGvZa+D9usT5ifK+/Nc4rMPskm6LZerRekShe2VWecI0RstQfDNxk QHDcecn1RBAJIGCeKkBf5xE/XdQ7QnQCQbK8oTzQ/ZMWNmlotmkGx0Zay90vUERw4Erj 7frA== X-Gm-Message-State: AOJu0YzEdk9bUs89XpbA5KfsqJMlz7WPM+ynDtRvt5fnXUEIwMHVoa4M gsbbqEry+9NppVXEDTh/5uPb+A== X-Google-Smtp-Source: AGHT+IHcv6vevrIegOMsPUFQyCv/avzOFaFQSkFN/F0K8MHoKKQIPPaIY0XxQhKRw86dUaWwyKYc4Q== X-Received: by 2002:a05:6a00:a88:b0:6bd:71e3:b647 with SMTP id b8-20020a056a000a8800b006bd71e3b647mr1103575pfl.19.1700265692645; Fri, 17 Nov 2023 16:01:32 -0800 (PST) Received: from [172.18.10.36] ([12.126.244.130]) by smtp.gmail.com with ESMTPSA id fd26-20020a056a002e9a00b00688435a9915sm1930180pfb.189.2023.11.17.16.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 16:01:32 -0800 (PST) Message-ID: <7fee9f31c2e82948fa56fe57d68eecb0cce36f10.camel@j-davis.com> Subject: Re: Change GUC hashtable to use simplehash? From: Jeff Davis To: Andres Freund Cc: Tom Lane , Gurjeet Singh , pgsql-hackers@postgresql.org Date: Fri, 17 Nov 2023 16:01:31 -0800 In-Reply-To: <20231117232712.mpnzsho7ydssg2oc@awork3.anarazel.de> References: <92f69b1ecc8f49a5a6c961edbdfe53c80000f484.camel@j-davis.com> <804316.1700258644@sss.pgh.pa.us> <20231117232712.mpnzsho7ydssg2oc@awork3.anarazel.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2023-11-17 at 15:27 -0800, Andres Freund wrote: > At > first I thought that that's largely because you aren't using > SH_STORE_HASH. I might want to use that in the search_path cache, then. The lookup wasn't showing up much in the profile the last I checked, but I'll take a second look. > Then I noticed that memory usage was too large when creating many > GUCs - a bit > of debugging later, I figured out that that's due to guc_name_hash() > being > terrifyingly bad. There's no bit mixing whatsoever! Wow. It seems like hash_combine() could be more widely used in other places, too? Here it seems like a worse problem because strings really need mixing, and maybe ExecHashGetHashValue doesn't. But it seems easier to use hash_combine() everywhere so that we don't have to think about strange cases. > I think, independent of this patch, it might be worth requiring that > hash > table lookups applied the transformation before the lookup. A > comparison > function this expensive is not great... The requested name is already case-folded in most contexts. We can do a lookup first, and if that fails, case-fold and try again. I'll hack up a patch -- I believe that would be measurable for the proconfigs. Regards, Jeff Davis