Re: Query returns no rows in pg_basebackup cluster

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "Adrian Klaver" <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Query returns no rows in pg_basebackup cluster
Date: 2020-05-22 05:40:51
Message-ID: 355991B0CB3940CCBF2E176348EE42BD@dell2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2020-05-22 05:52:28 Re: Query returns no rows in pg_basebackup cluster
Previous Message Andrus 2020-05-22 05:28:21 Re: Query returns no rows in pg_basebackup cluster