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 1jjsOY-0002g8-TY for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Jun 2020 22:43:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jjsOX-0004V0-OW for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Jun 2020 22:43:29 +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 1jjsOX-0004RP-5E for pgsql-bugs@lists.postgresql.org; Fri, 12 Jun 2020 22:43:29 +0000 Received: from mail.dalibo.com ([212.85.157.172]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjsOT-0004u2-9q for pgsql-bugs@lists.postgresql.org; Fri, 12 Jun 2020 22:43:27 +0000 Received: from firost (larco.ioguix.net [82.66.0.6]) by mail.dalibo.com (Postfix) with ESMTPSA id 5F8A1222E4; Sat, 13 Jun 2020 00:43:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1592001803; bh=QC7HWYkm3efrdtYTrzxA9tZD6077245z7B0nfyXPvHE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iJbztMigaqZnf1DJCT3kUeS/N9etsd7XyqVbCXXbFyMudo4xPUAl2Eocisr/nrriL 1uvfH/Js0pkJs4D0LQx9zm64lkrfJw+fGB1JmB0e+4jkF+b4NKKr4Iop/i7LNcsyO9 RL37jGBeLviN1EcGXdtI4+yY0V9pcR3URadDHdec= Date: Sat, 13 Jun 2020 00:43:22 +0200 From: Jehan-Guillaume de Rorthais To: Thomas Munro , Peter Geoghegan Cc: =?UTF-8?B?0KDQvtC80LDQvSDQm9C40YLQvtCy0YfQtdC90LrQvg==?= , PostgreSQL mailing lists Subject: Re: BUG #15285: Query used index over field with ICU collation in some cases wrongly return 0 rows Message-ID: <20200613004322.3bcc37f6@firost> In-Reply-To: <20200612184055.205f0159@firost> References: <153201618542.1404.3611626898935613264@wrigleys.postgresql.org> <20200610002933.6a6d482b@firost> <20200612184055.205f0159@firost> Organization: Dalibo MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/32JQsie2s2sNyXJu1noUQw9" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --MP_/32JQsie2s2sNyXJu1noUQw9 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Fri, 12 Jun 2020 18:40:55 +0200 Jehan-Guillaume de Rorthais wrote: > On Wed, 10 Jun 2020 00:29:33 +0200 > Jehan-Guillaume de Rorthais wrote: > [...] > > After playing with ICU regression tests, I found functions ucol_strcollIter > > and ucol_nextSortKeyPart are safe. I'll do some performance tests and report > > here. > > I did some benchmarks. See attachment for the script and its header to > reproduce. > > It sorts 935895 french phrases from 0 to 122 chars with an average of 49. > Performance tests were done on current master HEAD (buggy) and using the patch > in attachment, relying on ucol_strcollIter. > > My preliminary test with ucol_getSortKey was catastrophic, as we might > expect. 15-17x slower than the current HEAD. So I removed it from actual > tests. I didn't try with ucol_nextSortKeyPart though. > > Using ucol_strcollIter performs ~20% slower than HEAD on UTF8 databases, but > this might be acceptable. Here are the numbers: > > DB Encoding HEAD strcollIter ratio > UTF8 2.74 3.27 1.19x > LATIN1 5.34 5.40 1.01x > > I plan to add a regression test soon. Please, find in attachment the second version of the patch, with a regression test. Regards, --MP_/32JQsie2s2sNyXJu1noUQw9 Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=v2-0001-Replace-buggy-ucol_strcoll-funcs-with-ucol_strcollIt.patch