pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrus <kobruleht2@hot.ee>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Query returns no rows in pg_basebackup cluster
Date: Fri, 22 May 2020 08:40:51 +0300
Message-ID: <355991B0CB3940CCBF2E176348EE42BD@dell2> (raw)
In-Reply-To: <19749.1590104161@sss.pgh.pa.us>
References: <2B1267647FD14565B73801AF12CA1A88@dell2>
	<ea1e505d-d049-1d1d-e3b3-e655928949b8@aklaver.com>
	<17696.1590101245@sss.pgh.pa.us>
	<7736da96-5b03-d334-1be5-e593fc54d40b@aklaver.com>
	<CAKFQuwZ7UzCgCGNTSGoO4OXtgy_ZhLPN5uA_bwEX8T2Txm_iwA@mail.gmail.com>
	<19749.1590104161@sss.pgh.pa.us>

Hi!

>> 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.

There is composite index on baas column

CREATE TABLE public.desktop
(
    id integer NOT NULL DEFAULT nextval('desktop_id_seq'::regclass),
    recordtype character(5) COLLATE pg_catalog."default" NOT NULL,
    klass character(1) COLLATE pg_catalog."default",
    baas character(8) COLLATE pg_catalog."default" NOT NULL,
    liigid character(1) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    jrk numeric(4,0) NOT NULL DEFAULT 0,
...
    CONSTRAINT desktop_pkey PRIMARY KEY (id),
    CONSTRAINT desktop_baas_not_empty CHECK (baas <> ''::bpchar),
    CONSTRAINT desktop_id_check CHECK (id > 0),
    CONSTRAINT desktop_recordtype_check CHECK (recordtype = 'Aken'::bpchar OR recordtype = 'Veerg'::bpchar)
)

TABLESPACE pg_default;
CREATE INDEX desktop_baas_liigid_idx
    ON public.desktop USING btree
    (baas COLLATE pg_catalog."default" ASC NULLS LAST, liigid COLLATE pg_catalog."default" ASC NULLS LAST)
    TABLESPACE pg_default;

Maybe it is possible to force postgres in windows to use the same locale as in Linux. Locales are actually the same.

Andrus.






view thread (25+ messages)  latest in thread

Message-ID: <355991B0CB3940CCBF2E176348EE42BD@dell2>
Permalink:  ../355991B0CB3940CCBF2E176348EE42BD@dell2/
Also on:    postgresql.org/message-id/355991B0CB3940CCBF2E176348EE42BD@dell2

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: kobruleht2@hot.ee, tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, adrian.klaver@aklaver.com
  Subject: Re: Query returns no rows in pg_basebackup cluster
  In-Reply-To: <355991B0CB3940CCBF2E176348EE42BD@dell2>
  References: <2B1267647FD14565B73801AF12CA1A88@dell2> <ea1e505d-d049-1d1d-e3b3-e655928949b8@aklaver.com> <17696.1590101245@sss.pgh.pa.us> <7736da96-5b03-d334-1be5-e593fc54d40b@aklaver.com> <CAKFQuwZ7UzCgCGNTSGoO4OXtgy_ZhLPN5uA_bwEX8T2Txm_iwA@mail.gmail.com> <19749.1590104161@sss.pgh.pa.us> <355991B0CB3940CCBF2E176348EE42BD@dell2>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox