Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n5qBX-0002ya-NE for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Jan 2022 14:25:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n5qBW-00044T-CR for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Jan 2022 14:25:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n5qBW-00044K-2l for pgsql-hackers@lists.postgresql.org; Fri, 07 Jan 2022 14:25:38 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n5qBR-0007gi-Jc for pgsql-hackers@postgresql.org; Fri, 07 Jan 2022 14:25:37 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 276F05C01BC; Fri, 7 Jan 2022 09:25:31 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 07 Jan 2022 09:25:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=Fan4BtgGV3SV+R5tqam284Z2emviDNDKnS+0Qwx2B yg=; b=NU3SuPTrsjyBDJ93vGAMz+pSZ2MUoSD2ha8vLfTtNuv5wbN1pU4W3ajo0 6KFZIftRJSzfz495U/cZbIhSmgOCupLJUyjEHzxQj1AlzjFV3w2HnDZ3jiL/Hi3E oQvI3dMP+fCgUYCXk5j05TInOGT1arZYBHjp2K394if5Al6mgpchYLR3yzrksWcc 8EALyRSRNxy8DypfPTvmtAoCr2lLlExY3oTrQIfRAB5fN2x9g2NL5efifnSubUzN kGO+5OiompQq+zCIg3CAsNCkfTfmGa198yZvFoSq/OeRZ5YFppwh6cu48Eu39Jp1 GMuhLj9b8s0zCA5BVL2WutkLKo+dQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudegvddgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffhvfhfjggtgfesthekredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepfeeggfetfeduheehudff veelhfekueelhfffgfdvlefgffeuudeltdfgkeeihfejnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhht segvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 Jan 2022 09:25:29 -0500 (EST) Message-ID: Date: Fri, 7 Jan 2022 15:25:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: ICU for global collation Content-Language: en-US From: Peter Eisentraut To: Julien Rouhaud Cc: pgsql-hackers , Daniel Verite References: <374f8048-9d87-462c-a8aa-d02ffca6525f@manitou-mail.org> <525ef44f-52bf-505f-a491-07835d039424@enterprisedb.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 04.01.22 17:03, Peter Eisentraut wrote: >> There are really a lot of places with this new code.  Maybe it could >> be some >> new function/macro to wrap that for the normal case (e.g. not >> formatting.c)? > > Right, we could just put this into pg_newlocale_from_collation(), but > the comment there says > >  * In fact, they shouldn't call this function at all when they are dealing >  * with the default locale.  That can save quite a bit in hotspots. > > I don't know how to assess that. I tested this a bit. I used the following setup: create table t1 (a text); insert into t1 select md5(generate_series(1, 10000000)::text); select count(*) from t1 where a > ''; And then I changed in varstr_cmp(): if (collid != DEFAULT_COLLATION_OID) mylocale = pg_newlocale_from_collation(collid); to just mylocale = pg_newlocale_from_collation(collid); I find that the \timing results are indistinguishable. (I used locale "en_US.UTF-8" and made sure that that code path is actually hit.) Does anyone have other insights?