Re: Query performance - Mailing list pgsql-performance

From David G. Johnston
Subject Re: Query performance
Date
Msg-id CAKFQuwZoef=wqY=oJOO39ON-OGQKtza-BpeytBoqGRZqfdT6SQ@mail.gmail.com
Whole thread Raw
In response to Query performance  (Nagaraj Raj <nagaraj.sf@yahoo.com>)
List pgsql-performance
On Wed, Oct 21, 2020 at 5:32 PM Nagaraj Raj <nagaraj.sf@yahoo.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.

pgsql-performance by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: Query performance
Next
From: aditya desai
Date:
Subject: Re: CPU Consuming query. Sequential scan despite indexing.