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 1uSgk4-00BjNC-8n for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jun 2025 18:45:36 +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 1uSgk0-003haF-4K for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jun 2025 18:45:32 +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 1uSgjz-003ha7-KQ for pgsql-hackers@lists.postgresql.org; Fri, 20 Jun 2025 18:45:32 +0000 Received: from zebra.cherry.relay.mailchannels.net ([23.83.223.195]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uSgjx-003B44-0O for pgsql-hackers@postgresql.org; Fri, 20 Jun 2025 18:45:31 +0000 X-Sender-Id: dreamhost|x-authsender|nico@cryptonector.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 6412884937; Fri, 20 Jun 2025 18:45:26 +0000 (UTC) Received: from pdx1-sub0-mail-a221.dreamhost.com (100-127-221-91.trex-nlb.outbound.svc.cluster.local [100.127.221.91]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 07C7D848AE; Fri, 20 Jun 2025 18:45:26 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1750445126; a=rsa-sha256; cv=none; b=4Xveau9nFVZX8tcZVxl7ERr49W01FKT0fpf40O9/Rq6hm4vvTr7BtEj38iXTa9/TeYDASA /yQLCkRc6VwXQZXZIrwA3zSuOdbGYum/JPezNrRVa0z91Ch3M0ASoHdUrsute5buZfkFhN Wtgs94KBVmIu44xYqOnM5H1lAedf2ty0/mzg+jx7K8TMxH5g8mfc42JejXrY6J0rMCYUBS B8hT56kmRkwLH0669JJXd5XxYClq5tPJlLK51eznFtz8ROHulre8De/9HFBVI2XocbAuUg saAD6y/Z01NZ4qlOhcseuh92Cl5zCIOocGk2N8ybt7eo83MFT6tnqyFSsWvY4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1750445126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=4ufxSMo9tSH+v8RAX/pLJXL86xzxAWvqYNjOJNrjrhQ=; b=CSP075rKUsWoCbtQNyXwhPIjtOeKkdPdnAuBaNDG0MIFPMk5F7R1vwfLRh8JKYagUOrE6k E8L0Jlju27rtt2lJ/pmC6tGcG2d5j7s+eNK1ntB2CR7IMwqAoKhvZBqFrkGK89u8T75QkU jCrSAo1OCkfbbV7VoQDQPRjiwTpOXubXxXkNQ6MVCY/F+igg5GyEnrKNDZPYDhzCTfA48M HXbtI366i82QC4FXh8CPwpZIh3s2SaxIwr67jEiMVUv3Otf/BEHVaTWbqUC3LH0ZuC1MHC ZfhR1ItMRa+w1jfdvIZDF+wJSF8bmhKfa3ZDvllX4irwbCSq3Hso9UXTIs6S5A== ARC-Authentication-Results: i=1; rspamd-679c59f89-9stmf; auth=pass smtp.auth=dreamhost smtp.mailfrom=nico@cryptonector.com X-Sender-Id: dreamhost|x-authsender|nico@cryptonector.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|nico@cryptonector.com X-MailChannels-Auth-Id: dreamhost X-Spill-Quick: 5f8fb0d741ec54de_1750445126277_2122910435 X-MC-Loop-Signature: 1750445126277:4058246640 X-MC-Ingress-Time: 1750445126277 Received: from pdx1-sub0-mail-a221.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.127.221.91 (trex/7.0.3); Fri, 20 Jun 2025 18:45:26 +0000 Received: from ubby (syn-075-081-095-064.res.spectrum.com [75.81.95.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nico@cryptonector.com) by pdx1-sub0-mail-a221.dreamhost.com (Postfix) with ESMTPSA id 4bP5yF2rxLzGV; Fri, 20 Jun 2025 11:45:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cryptonector.com; s=dreamhost; t=1750445125; bh=4ufxSMo9tSH+v8RAX/pLJXL86xzxAWvqYNjOJNrjrhQ=; h=Date:From:To:Cc:Subject:Content-Type; b=qFT0TqX4nRQowiTSEBxglF1d5DqcBJOH0ddiJfMQCnin4FQW7wuFqbiOHEWOdvJZ1 mg3bCy0jgsLzj2rVxvO+GRb5JSlqnXnK0CmH2x2kd5V843fFo41GdnfDu18CCwFGZ5 vw/cfjSHCTwdG9zf9mBHq4hm8INa+39mKMExAG5cSLVAyi/2K6vS3MKd2vh3oJpQU0 DZwKNRMm75mf8Y6rPuV+saiWAYxAHOJt6tZn2vLdDD/kUiAcJ6wy6lt3VoFxHVp3rl mr17rksGsimLDYYX4TCjKHl5oy8xPN2wd34ss1PKEhQrsE+0ThApN1tccpbNsmbnXM tw+/33P8r3chw== Date: Fri, 20 Jun 2025 13:45:22 -0500 From: Nico Williams To: Jeff Davis Cc: Alexander Borisov , PostgreSQL Hackers Subject: Re: Improve the performance of Unicode Normalization Forms. Message-ID: References: <844d3dd7-2955-4794-95d1-7f4c13cb89fc@gmail.com> <4211ffd7fe154c4af693b98d78f4a3689ce8cc30.camel@j-davis.com> <792ee592556431aaa2ad1570a978574f53e5be7a.camel@j-davis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <792ee592556431aaa2ad1570a978574f53e5be7a.camel@j-davis.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jun 20, 2025 at 10:15:47AM -0700, Jeff Davis wrote: > On Fri, 2025-06-20 at 11:31 -0500, Nico Williams wrote: > > In the slow path you only normalize the _current character_, so you > > only need enough buffer space for that. > > That's a clear win for UTF8 data. Also, if there are no changes, then > you can just return the input buffer and not bother allocating an > output buffer. The latter is not relevant to string comparison or hashing, but, yeah, if you have to produce a normalized string you can optimistically assume it is already normalized and defer allocation until you know it isn't normalized. > Postgres is already form-preserving; it does not auto-normalize. (I > have suggested that we might want to offer something like that, but > that would be a user choice.) Excellent, then I would advise looking into adding form-insensitive string comparison and hashing to get f-i/f-p behavior. > Currently, the non-deterministic collations (which offer form- > insensitivity) are not available at the database level, so you have to > explicitly specify the COLLATE clause on a column or query. In other > words, Postgres is not form-insensitive by default, though there is > work to make that possible. TIL. Thanks. > Databases have similar concerns as a filesystem in this respect. I figured :)