Re: Very slow Query compared to Oracle / SQL - Server

From: luis(dot)roberto(at)siscobra(dot)com(dot)br
To: Semen Yefimenko <semen(dot)yefimenko(at)gmail(dot)com>
Cc: pgsql-performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Very slow Query compared to Oracle / SQL - Server
Date: 2021-05-06 16:11:07
Message-ID: 1368981627.1376962.1620317467043.JavaMail.zimbra@siscobra.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


----- Mensagem original -----
> De: "Semen Yefimenko" <semen(dot)yefimenko(at)gmail(dot)com>
> Para: "pgsql-performance" <pgsql-performance(at)lists(dot)postgresql(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Alexey M Boltenkov 2021-05-06 18:15:36 Re: Very slow Query compared to Oracle / SQL - Server
Previous Message Semen Yefimenko 2021-05-06 14:38:39 Very slow Query compared to Oracle / SQL - Server