From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: sreekanth vajrapu <sreekanthvajrapu@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Query is slow when order by and limit clause are used in the query
Date: Mon, 24 May 2021 16:33:10 +0530
Message-ID: <CALj2ACUGa2DmNSSYdN9H03nLkP57dSa3R2KMqvm091KARXS5Sw@mail.gmail.com> (raw)
In-Reply-To: <CAKPbTYioxLr=yv_iZfP2AHs3VeM_v8njgnBM5DofDpyhMTtBmQ@mail.gmail.com>
References: <CAKPbTYioxLr=yv_iZfP2AHs3VeM_v8njgnBM5DofDpyhMTtBmQ@mail.gmail.com>
On Mon, May 24, 2021 at 4:19 PM sreekanth vajrapu
<sreekanthvajrapu@gmail.com> wrote:
>
>
> Hi Team,
>
> We are having a slow query issue for one of our applications. We are seeing slowness(5 seconds) when we use both ORDER BY and LIMIT 30 clause whereas the same query is performing very good(200 MS) when using only ORDER BY clause. Also note that the query performed very fast(200 MS) when we increased LIMIT to 100 along with ORDER BY.
>
>
> Can you please help us if there are any bugs related to this? OR Can someone kindly provide some solution to this issue?
I think it's good to provide explain (analyze, buffers, costs,
verbose, summary) of the query and a reproducible test case (if
possible). It will be easier for those who investigate the issue.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: bharath.rupireddyforpostgres@gmail.com, sreekanthvajrapu@gmail.com
Subject: Re: Query is slow when order by and limit clause are used in the query
In-Reply-To: <CALj2ACUGa2DmNSSYdN9H03nLkP57dSa3R2KMqvm091KARXS5Sw@mail.gmail.com>
References: <CAKPbTYioxLr=yv_iZfP2AHs3VeM_v8njgnBM5DofDpyhMTtBmQ@mail.gmail.com> <CALj2ACUGa2DmNSSYdN9H03nLkP57dSa3R2KMqvm091KARXS5Sw@mail.gmail.com>
* 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