Re: Query returns no rows in pg_basebackup cluster - Mailing list pgsql-general

From Tom Lane
Subject Re: Query returns no rows in pg_basebackup cluster
Date
Msg-id 19749.1590104161@sss.pgh.pa.us
Whole thread Raw
In response to Re: Query returns no rows in pg_basebackup cluster  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Query returns no rows in pg_basebackup cluster  ("Andrus" <kobruleht2@hot.ee>)
List pgsql-general
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thu, May 21, 2020 at 3:57 PM Adrian Klaver <adrian.klaver@aklaver.com>
> 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



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Query returns no rows in pg_basebackup cluster
Next
From: Tim Cross
Date:
Subject: Re: Should I use JSON?