Re: Query performance

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Nagaraj Raj <nagaraj(dot)sf(at)yahoo(dot)com>
Cc: Pgsql Performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Query performance
Date: 2020-10-22 01:11:15
Message-ID: CAKFQuwZoef=wqY=oJOO39ON-OGQKtza-BpeytBoqGRZqfdT6SQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Oct 21, 2020 at 5:32 PM Nagaraj Raj <nagaraj(dot)sf(at)yahoo(dot)com> wrote:

> Hi, I have long running query which running for long time and its planner
> always performing sequnce scan the table2.
>

FROM sor_t.transfer_order_header hed,sor_t.transfer_order_item itm
> where hed.eventid=itm.eventid group by 1,2,3,4,5,6
>
> Any suggestions would greatly appretiated.
>

You aren't filtering out any rows so it is unsurprising that a sequential
scan was chosen to fulfil the request that the entire detail table be
consulted. The good news is you have access to parallelism - see if you
can increase that factor.

Any other suggestions probably requires more knowledge of your problem
domain than you've provided here.

Finding a way to add a where clause or compute your desired result during
record insertion or updating are two other potential avenues of
consideration.

David J.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message aditya desai 2020-10-22 05:21:40 Re: CPU Consuming query. Sequential scan despite indexing.
Previous Message Justin Pryzby 2020-10-22 01:09:07 Re: Query performance