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 1lejde-0001QM-8H for pgsql-performance@arkaria.postgresql.org; Thu, 06 May 2021 19:26:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lejdd-00064i-5L for pgsql-performance@arkaria.postgresql.org; Thu, 06 May 2021 19:26:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lejdc-000622-Q6 for pgsql-performance@lists.postgresql.org; Thu, 06 May 2021 19:26:20 +0000 Received: from post.visena.com ([46.226.10.50]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lejdV-0006a7-Ng for pgsql-performance@lists.postgresql.org; Thu, 06 May 2021 19:26:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=visena.com; s=20141101.wh; h=Content-Type:MIME-Version:Subject:References:In-Reply-To: Message-ID:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=em7Y3hRwVG/f82Lrjw+wzytykvG4MAhEmLZtR0xCf2M=; b=l1cLRlpCN9BWl4TzcjjtBLPCWw ByNNWlQgZW7gwtlDT+NSzCpsGzLkv3Za5PnjKh8fBD/8Gkh5G+cIbOLVBxVBt6413XAa8pCac+M/R ijJVP1TnEgpGeizumROe9Q6diyJCY6EJAgBeUXhj4Or+kPsWK1FO8zuoXiv2nCbw8d38=; Received: from tc7-visena.wh.internal.visena.com ([10.0.1.10]) by post.visena.com with esmtp (Exim 4.93) (envelope-from ) id 1lejdP-008cv7-JB; Thu, 06 May 2021 21:26:07 +0200 Received: from localhost ([127.0.0.1] helo=tc7-visena.wh.internal.visena.com) by tc7-visena.wh.internal.visena.com with esmtp (Exim 4.90_1) (envelope-from ) id 1lejdP-0002GO-Fk; Thu, 06 May 2021 21:26:07 +0200 Date: Thu, 6 May 2021 21:26:07 +0200 (CEST) From: Andreas Joseph Krogh To: Semen Yefimenko Cc: Alexey M Boltenkov , luis.roberto@siscobra.com.br, pgsql-performance Message-ID: In-Reply-To: References: <1368981627.1376962.1620317467043.JavaMail.zimbra@siscobra.com.br> <9a713ea4-f672-412c-70c3-34b82c275b7f@yandex.ru> <986d20ff-a662-6821-68f4-d5a8ba304eb7@yandex.ru> Subject: Re: Very slow Query compared to Oracle / SQL - Server MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_5_1452866116.1620329167328" X-Mailer: Visena Mail 2.2.655-SNAPSHOT List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------=_Part_5_1452866116.1620329167328 Content-Type: multipart/related; boundary="----=_Part_6_724878603.1620329167328" ------=_Part_6_724878603.1620329167328 Content-Type: multipart/alternative; boundary="----=_Part_7_877477471.1620329167413" ------=_Part_7_877477471.1620329167413 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable P=C3=A5 torsdag 06. mai 2021 kl. 20:59:34, skrev Semen Yefimenko < semen.yefimenko@gmail.com >:=20 Yes, rewriting the query with an IN clause was also my first approach, but = I=20 didn't help much. The Query plan did change a little bit but the performance was not impacte= d. CREATE INDEX idx_arcstatus_le1 ON schema.logtable ( archivestatus ) where= =20 (archivestatus <=3D 1)=20 ANALYZE schema.logtable=20 This resulted in this query plan: [...]=20 I assume (4000,4001,4002) are just example-values and that they might be=20 anything? Else you can just include them in your partial-index.=20 -- Andreas Joseph Krogh=20 ------=_Part_7_877477471.1620329167413 Content-Type: text/html;charset=UTF-8 Content-Transfer-Encoding: quoted-printable
P=C3=A5 torsdag 06. mai 2021 kl. 20:59:34, skrev Semen Yefimenko <<= a href=3D"mailto:semen.yefimenko@gmail.com">semen.yefimenko@gmail.com&g= t;:
Yes, rewriting the query with an IN clause was also my fir= st approach, but I didn't help much.=C2=A0
The Query plan did change a little bit but the performance was not impacted= .
=C2=A0
CREATE INDEX idx_arcstatus_le1 ON schema.logtable ( arc= hivestatus ) where=C2=A0(archivestatus <=3D 1)
ANALYZE=C2=A0 schema.logtable

This resulted in this query plan:
[...]
=C2=A0
I assume=C2=A0(4000,4001,4002) are just example-values and that they m= ight be anything? Else you can just include them in your partial-index.
">
=C2=A0
--
Andreas Joseph Krogh
------=_Part_7_877477471.1620329167413-- ------=_Part_6_724878603.1620329167328-- ------=_Part_5_1452866116.1620329167328--