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 1jJudL-0005QO-Jr for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Apr 2020 07:51:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJudJ-0005Tk-01 for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Apr 2020 07:51:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJudI-0005Pa-P7 for pgsql-hackers@lists.postgresql.org; Thu, 02 Apr 2020 07:51:24 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJudG-0005Kw-JM for pgsql-hackers@postgresql.org; Thu, 02 Apr 2020 07:51:23 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id AB1895C0192; Thu, 2 Apr 2020 03:51:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 02 Apr 2020 03:51:21 -0400 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=fm2; bh=hmQS+2zT0uj3PBVOoEU0TXzU5qrynORiWwVKxAytD To=; b=y075BeIWWlepqoUtrIxQ3MtbvhrEA5VBSgo2Hlw9TZmvmcvBi2hTD+E+a w/GxgdxgAXD6osTqqZKOmeZZ0NTctVx+9iWPXYNXQXZKKIfhBUTnhpqWBth0+lxo tO8+9KZl7VzsI3EeRyW6WjgI6mULhxNH8MfHA+Dytl+zoI38BILrWDltGOs4p19K Cp6nUF+Z9OrIcyGR/Y0FzygHl0qejrhcEquh9hEBGJeLwvKt2gnJWSbAWIBRyNc3 zgZw0Irc6g2Az5yYl1s0xNhvw/iMGw/MUXRlLDDl/jitl5T96akgW97vHPRqsOnu CpSzGAVoSy6Cf/FfiHHIopSBXevgw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtdefgdduvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhohfkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvdhnug hquhgrughrrghnthdrtghomheqnecuffhomhgrihhnpedvnhguqhhurggurhgrnhhtrdgt ohhmnecukfhppeelfedrvdegvddrvddufedrvdegudenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghuthes vdhnughquhgrughrrghnthdrtghomh X-ME-Proxy: Received: from april.pezone.net (p5df2d5f1.dip0.t-ipconnect.de [93.242.213.241]) by mail.messagingengine.com (Postfix) with ESMTPA id 5B79A328005A; Thu, 2 Apr 2020 03:51:20 -0400 (EDT) Subject: Re: Unicode normalization SQL functions To: John Naylor References: <6d55838c-9353-486f-a508-77ee07d59667@manitou-mail.org> <620b155b-a89c-d8e0-3cbb-315c3ca538f4@2ndquadrant.com> <7052cc8f-0164-72a8-d9a4-fd32066c938e@2ndquadrant.com> Cc: pgsql-hackers , Daniel Verite , Andreas Karlsson From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <2d3e7d66-0f89-a663-280b-45d5b88b196b@2ndquadrant.com> Date: Thu, 2 Apr 2020 09:51:19 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-03-26 18:41, John Naylor wrote: > We don't have a trie implementation in Postgres, but we do have a > perfect hash implementation. Doing that would bring the tables back to > 64 bits per entry, but would likely be noticeably faster than binary > search. Since v4 has left out the biggest tables entirely, I think > this might be worth a look for the smaller tables remaining. > > In the attached v5, when building the hash tables, we sort the code > points by NO/MAYBE, and store the index of the beginning of the NO > block: This is a valuable idea, but I fear it's a bit late now in this cycle. I have questions about some details. For example, you mention that you had to fiddle with the hash seed. How does that affect other users of PerfectHash? What happens when we update Unicode data and the hash doesn't work anymore? These discussions might derail this patch at this hour, so I have committed the previous patch. We can consider your patch as a follow-up patch, either now or in the future. > Also, if we go with v4, I noticed the following test is present twice: > > +SELECT "normalize"('abc', 'def'); -- run-time error I think this is correct. The other test is for "is_normalized". -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services