Re: Very slow Query compared to Oracle / SQL - Server - Mailing list pgsql-performance

From luis.roberto@siscobra.com.br
Subject Re: Very slow Query compared to Oracle / SQL - Server
Date
Msg-id 1368981627.1376962.1620317467043.JavaMail.zimbra@siscobra.com.br
Whole thread Raw
In response to Very slow Query compared to Oracle / SQL - Server  (Semen Yefimenko <semen.yefimenko@gmail.com>)
Responses Re: Very slow Query compared to Oracle / SQL - Server
List pgsql-performance
----- Mensagem original -----
> De: "Semen Yefimenko" <semen.yefimenko@gmail.com>
> Para: "pgsql-performance" <pgsql-performance@lists.postgresql.org>
> Enviadas: Quinta-feira, 6 de maio de 2021 11:38:39
> Assunto: Very slow Query compared to Oracle / SQL - Server


> SELECT column1,..., column54 where ((entrytype = 4000 or entrytype = 4001 or
> entrytype = 4002) and (archivestatus <= 1)) order by timestampcol desc;
 

The first thing I would try is rewriting the query to:

SELECT column1,..., column54 
  FROM logtable
 WHERE (entrytype in (4000,4001,4002)) 
   AND (archivestatus <= 1)) 
 ORDER BY timestampcol DESC;

Check if that makes a difference...

Luis R. Weck 



pgsql-performance by date:

Previous
From: Semen Yefimenko
Date:
Subject: Very slow Query compared to Oracle / SQL - Server
Next
From: Alexey M Boltenkov
Date:
Subject: Re: Very slow Query compared to Oracle / SQL - Server