Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8AEN-0002Fb-QM for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Apr 2018 19:56:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f8AEL-0007KJ-Ur for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Apr 2018 19:56:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8AEL-0007K9-OU for pgsql-bugs@lists.postgresql.org; Mon, 16 Apr 2018 19:56:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8AEI-0006LJ-Fw for pgsql-bugs@postgresql.org; Mon, 16 Apr 2018 19:56:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w3GJtqEt026054; Mon, 16 Apr 2018 15:55:52 -0400 From: Tom Lane To: Peter Geoghegan cc: Emre Hasegeli , Teodor Sigaev , PostgreSQL Bugs Subject: Re: Wrong Results from SP-GiST with Collations In-reply-to: References: <19693.1523904666@sss.pgh.pa.us> <20362.1523906934@sss.pgh.pa.us> Comments: In-reply-to Peter Geoghegan message dated "Mon, 16 Apr 2018 12:39:54 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26052.1523908552.1@sss.pgh.pa.us> Date: Mon, 16 Apr 2018 15:55:52 -0400 Message-ID: <26053.1523908552@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Geoghegan writes: > On Mon, Apr 16, 2018 at 12:28 PM, Tom Lane wrote: >> True. This way saves a few cycles, but maybe it's not worth the extra >> code. I think the only case where you could really notice the difference >> is for an equality search operator, which might end up doing a lot more >> work in non-C collations (full-blown strcoll vs memcmp). > I don't have a full understanding of this particular problem, but it > sounds to me that that would be a non-issue due to the equality > fast-path added to varstr_cmp() several years ago. I microbenchmarked > it quite extensively at the time, and concluded that it was all but > free in cases where it didn't work out. I'm not following --- varstr_cmp has no way to know that we only care about equality vs inequality. Yes, it might give back an answer quickly when the strings are equal, but when they aren't, it has to decide which is greater. In this case we don't care, so long as the search operator is "=". regards, tom lane