pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: luis.roberto@siscobra.com.br
To: Semen Yefimenko <semen.yefimenko@gmail.com>
Cc: pgsql-performance <pgsql-performance@lists.postgresql.org>
Subject: Re: Very slow Query compared to Oracle / SQL - Server
Date: Thu, 6 May 2021 13:11:07 -0300 (BRT)
Message-ID: <1368981627.1376962.1620317467043.JavaMail.zimbra@siscobra.com.br> (raw)
In-Reply-To: <CAKnyMoKUUSPiH=0QaM38GYm8UqVeR47HmX+MX+UpyL0mLERBrw@mail.gmail.com>
References: <CAKnyMoKUUSPiH=0QaM38GYm8UqVeR47HmX+MX+UpyL0mLERBrw@mail.gmail.com>


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





view thread (25+ messages)  latest in thread

Message-ID: <1368981627.1376962.1620317467043.JavaMail.zimbra@siscobra.com.br>
Permalink:  ../1368981627.1376962.1620317467043.JavaMail.zimbra@siscobra.com.br/
Also on:    postgresql.org/message-id/1368981627.1376962.1620317467043.JavaMail.zimbra@siscobra.com.br

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: luis.roberto@siscobra.com.br, semen.yefimenko@gmail.com, pgsql-performance@lists.postgresql.org
  Subject: Re: Very slow Query compared to Oracle / SQL - Server
  In-Reply-To: <1368981627.1376962.1620317467043.JavaMail.zimbra@siscobra.com.br>

* 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