Re: Help me in reducing the CPU cost for the high cost query below, as it is hitting production seriously!!

2018-05-23 Thread Justin Pryzby
On Wed, May 23, 2018 at 10:20:42PM -0700, pavan95 wrote: > Hi Justin, > > Please find the below explain plan link. > > Link: https://explain.depesz.com/s/owE That's explain analyze but explain(analyze,buffers) is better. Is this on a completely different server than the previous plans ? Th

Re: Help me in reducing the CPU cost for the high cost query below, as it is hitting production seriously!!

2018-05-23 Thread pavan95
Hi Justin, Please find the below explain plan link. Link: https://explain.depesz.com/s/owE Any help is appreciated. Thanks in Advance. Regards, Pavan -- Sent from: http://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html

Re: Help me in reducing the CPU cost for the high cost query below, as it is hitting production seriously!!

2018-05-23 Thread Justin Pryzby
On Wed, May 23, 2018 at 07:03:18AM -0700, pavan95 wrote: > Please find the explain plan which got increased again vastly. Is this > because of the increase in rows? > > Link : https://explain.depesz.com/s/Ifr That's explain without "analyze", so not very useful. There's handful of questions:

Re: dsa_allocate() faliure

2018-05-23 Thread Sand Stone
>> At which commit ID? 83fcc615020647268bb129cbf86f7661feee6412 (5/6) >>do you mean that these were separate PostgreSQL clusters, and they were all >>running the same query and they all crashed like this? A few worker nodes, a table is hash partitioned by "aTable.did" by Citus, and further partit

Re: Help me in reducing the CPU cost for the high cost query below, as it is hitting production seriously!!

2018-05-23 Thread pavan95
Hi Justin, >How big is the table ? And curract_state_isfinal_app_idx ? >Have these been reindexed (or pg_repacked) recently? The size of the table 'tms_workflow_history' is 7600Kb(which is pretty small). Yes those indexes were dropped and recreated. >It looks like you resolved the bad estima

Re: Help me in reducing the CPU cost for the high cost query below, as it is hitting production seriously!!

2018-05-23 Thread pavan95
Hi Matthew, Yeah and you said right!. I have analyzed the entire database and also created appropriate indexes for the columns used in WHERE/JOIN clauses. Okay I will just provide the fourth union part of the query which you can analyze easier(this not that big). Please find the query part. And

Re: Help me in reducing the CPU cost for the high cost query below, as it is hitting production seriously!!

2018-05-23 Thread Justin Pryzby
On Wed, May 23, 2018 at 12:01:06AM -0700, pavan95 wrote: > As said, created index on the res_users.res_employee_id and the below link > is the explain plan result. > > Link: https://explain.depesz.com/s/hoct > > And the cost of Previous query is 92,129 and the cost of current modified > query af

Re: Help me in reducing the CPU cost for the high cost query below, as it is hitting production seriously!!

2018-05-23 Thread mlunnon
Hi Pavan, that's quite a big query. I can see that the generate_series function is getting repeatedly called and the planner estimates for this sub query are out by a factor of 66. You might try to re-write using a WITH query. I am assuming that you have already analyzed all the tables and also add

Re: Help me in reducing the CPU cost for the high cost query below, as it is hitting production seriously!!

2018-05-23 Thread pavan95
Hi all/Justin, As said, created index on the res_users.res_employee_id and the below link is the explain plan result. Link: https://explain.depesz.com/s/hoct . And the cost of Previous query is 92,129 and the cost of current modified query after creating the above said index is 91,462. But go