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 1qT8sg-008YWJ-2W for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Aug 2023 22:39:18 +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 1qT8sd-00C0ck-LG for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Aug 2023 22:39:16 +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 1qT8sd-00C0cc-CI for pgsql-hackers@lists.postgresql.org; Mon, 07 Aug 2023 22:39:15 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qT8sa-001AwV-Qu for pgsql-hackers@postgresql.org; Mon, 07 Aug 2023 22:39:15 +0000 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-686daaa5f1fso3427268b3a.3 for ; Mon, 07 Aug 2023 15:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691447950; x=1692052750; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=T0/su+MJRNuVUWwwjLcUJEOVwKJuanI/NRwgL2QON3A=; b=dMCqkh6yXhssQz2dgg6JpwbZMJ5hCYIfBTD0kJm41oHJuQJMi4dUMgBqiBUyE4Tp7d 2k+hzhdMeelDqdyil+DXKldpCFyThPp/FHVOxk0yPYMT3JsmtXK2lrF7e9HnTETY/g/4 BsRsCvTP5wO6vjYwbP36XhJUiU+0JHQDkRXvAAyKkgEchqZ/2TMplSSeUxJFi3nBmkSc W4THj3PzTao03sXgDp1Wh/CmNJ7xKYDSasMElgnMxFBa+DxqWj3sHes++cl8JeH2V4od /7FxuL2GxFElRFrtz3+w0XatcoGww6kxTf0Q6pCaWy7OxX8sdeL3rvGu6MlEjKVm99Zd hblQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691447950; x=1692052750; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=T0/su+MJRNuVUWwwjLcUJEOVwKJuanI/NRwgL2QON3A=; b=dru5qmysp5WDlSDNJhUYFR7/TDXwrSpqzp0GAAyV85SVObbjKv87jUYupmRWQ4vBvH GqpQXGEKlJuUMQi2zo2LU6Eb9ISHvtYrSUb9bKcG+zQtnd1JQRUos2r1kHlJa7ILa74W ntUB1CmJZw3cfa7IofFInI46tm8czrf7gZ2m3JzkbUDSqHvWv6aJUALzndbnySiSzG23 JGMPWVhn2XIoDVIZVd6zqbr9hBEBLKfMCXvLiMi8/IuZcOuxFetjEjjrt6/hre0QHivq BIBrq4JAVFsSOpKOFNZifrzBd7noCLZDzJnc8v31TKbTTySbyI119bHmcwEfkO0csSj/ qM0Q== X-Gm-Message-State: AOJu0YzQdGlih+ACil3IULk5LZBiJ9aR+Q3d+h3QRxSno9n1Yhc6+2jN XKn1FywtMtPKvkfJNXpKIqs= X-Google-Smtp-Source: AGHT+IFLCKKFyNcVxjfTQi9/cOPI0usQt7CyCxgiBCUFviqCVzIsgvH04S+zun8gHf7lTcW1S1I83Q== X-Received: by 2002:a17:903:11c5:b0:1b8:94e9:e7b0 with SMTP id q5-20020a17090311c500b001b894e9e7b0mr9058649plh.9.1691447950510; Mon, 07 Aug 2023 15:39:10 -0700 (PDT) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id n11-20020a1709026a8b00b001bb889530adsm3560303plk.217.2023.08.07.15.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 15:39:09 -0700 (PDT) Date: Mon, 7 Aug 2023 15:39:08 -0700 From: Nathan Bossart To: Jeff Davis Cc: Isaac Morland , pgsql-hackers@postgresql.org Subject: Re: Faster "SET search_path" Message-ID: <20230807223908.GB1284531@nathanxps13> References: <04c8592dbd694e4114a3ed87139a7a04e4363030.camel@j-davis.com> <20230802050720.GB866741@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 0001 and 0002 LGTM. 0003 is looking pretty good, too, but I think we should get some more eyes on it, given the complexity. On Mon, Aug 07, 2023 at 12:57:27PM -0700, Jeff Davis wrote: > (Aside: part of the reason set_config_option() is slow is because of > the lookup in guc_hashtab. That's slower than some other hash lookups > because it does case-folding, which needs to be done in both the hash > function and also the match function. The hash lookups in > SearchPathCache are significantly faster. I also have a patch to change > guc_hashtab to simplehash, but I didn't see much difference.) I wonder if it'd be faster to downcase first and then pass it to hash_bytes(). This would require modifying the key, which might be a deal-breaker, but maybe there's some way to improve find_option() for all GUCs. > But in general I'd prefer to optimize cases that are going to work > nicely by default for a lot of users (especially switching to a safe > search path), without the need for obscure knowledge about the > performance implications of the session search_path. And to the extent > that we do optimize for the pre-existing search_path, I'd like to > understand the inherent overhead of changing the search path versus > incidental overhead. +1 -- Nathan Bossart Amazon Web Services: https://aws.amazon.com