agora inbox for pgsql-performance@postgresql.org
help / color / mirror / Atom feedFrom: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Nagaraj Raj <nagaraj.sf@yahoo.com>
Cc: Pgsql Performance <pgsql-performance@lists.postgresql.org>
Subject: Re: Query performance issue
Date: Fri, 4 Sep 2020 23:36:35 +0200
Message-ID: <20200904213635.hvz2pxmmj3tatv26@development> (raw)
In-Reply-To: <975305787.3395625.1599254321500@mail.yahoo.com>
References: <975305787.3395625.1599254321500.ref@mail.yahoo.com>
<975305787.3395625.1599254321500@mail.yahoo.com>
On Fri, Sep 04, 2020 at 09:18:41PM +0000, Nagaraj Raj wrote:
> I have a query which will more often run on DB and very slow and it is doing 'seqscan'. I was trying to optimize it by adding indexes in different ways but nothing helps.
>Any suggestions?
>
1) It's rather difficult to read the query plan as it's mangled by your
e-mail client. I recommend to check how to prevent the client from doing
that, or attaching the plan as a file.
2) The whole query takes ~3500ms, and the seqscan only accounts for
~200ms, so it's very clearly not the main issue.
3) Most of the time is spent in sort, so the one thing you can do is
either increasing work_mem, or adding index providing that ordering.
Even better if you include all necessary columns to allow IOS.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
view thread (57+ messages) latest in thread
Message-ID: <20200904213635.hvz2pxmmj3tatv26@development>
Permalink: ../20200904213635.hvz2pxmmj3tatv26@development/
Also on: postgresql.org/message-id/20200904213635.hvz2pxmmj3tatv26@development
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: tomas.vondra@2ndquadrant.com, nagaraj.sf@yahoo.com, pgsql-performance@lists.postgresql.org
Subject: Re: Query performance issue
In-Reply-To: <20200904213635.hvz2pxmmj3tatv26@development>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox