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 1jbujV-00064l-Gv for pgsql-general@arkaria.postgresql.org; Thu, 21 May 2020 23:36:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jbujU-0005gn-Cn for pgsql-general@arkaria.postgresql.org; Thu, 21 May 2020 23:36:12 +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 1jbujU-0005gg-5F for pgsql-general@lists.postgresql.org; Thu, 21 May 2020 23:36:12 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbujR-0007C8-TB for pgsql-general@postgresql.org; Thu, 21 May 2020 23:36:11 +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 04LNa1bI019750; Thu, 21 May 2020 19:36:01 -0400 From: Tom Lane To: "David G. Johnston" cc: Adrian Klaver , Andrus , pgsql-general Subject: Re: Query returns no rows in pg_basebackup cluster In-reply-to: References: <2B1267647FD14565B73801AF12CA1A88@dell2> <17696.1590101245@sss.pgh.pa.us> <7736da96-5b03-d334-1be5-e593fc54d40b@aklaver.com> Comments: In-reply-to "David G. Johnston" message dated "Thu, 21 May 2020 16:06:39 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19748.1590104161.1@sss.pgh.pa.us> Date: Thu, 21 May 2020 19:36:01 -0400 Message-ID: <19749.1590104161@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "David G. Johnston" writes: > On Thu, May 21, 2020 at 3:57 PM Adrian Klaver > wrote: >> Well what I was trying to figure out was: >> "Windows server this query returns 0 rows. >> In Windows server same query using like >> select * from firma1.desktop where baas like '_LOGIFAI' >> returns properly 16 rows. " > The LIKE query probably doesn't use an index and thus finds the relevant > data via sequential scan and equality checks on each record. Yeah, exactly. An equality condition will use a btree index if available. LIKE, however, sees the "_" as a wildcard so it cannot use an index and resorts to a seqscan --- which will work fine. It's just index searches (and index-based sorts) that are broken. Of course, if there isn't an index on the column in question then this theory falls to the ground. regards, tom lane