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

2018-05-21 Thread mlunnon
pavan95 wrote > *Query*: > > explain select ... from tms_timesheet_details, tms_wsr_header header > where wsr_header_id=header.id and work_order_no != 'CORPORATE'; > > QUERY PLAN > -

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

2018-05-21 Thread David G. Johnston
On Mon, May 21, 2018 at 7:43 AM, pavan95 wrote: > Hi David, > > Thank you so much for your valuable inputs. Is there anything that I need > to look from Indexes perspective or Join order ?? > > Kindly let me know if it can be tuned further. > What I've got to give here is what you've received.

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

2018-05-21 Thread pavan95
Hi David, Thank you so much for your valuable inputs. Is there anything that I need to look from Indexes perspective or Join order ?? Kindly let me know if it can be tuned further. Thank you very much. Regards, Pavan -- Sent from: http://www.postgresql-archive.org/PostgreSQL-performanc

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

2018-05-21 Thread pavan95
Hi abbas, Thank you so much. I've got this query from my development team asking to improve its performance. Now I got pretty much clear idea of it. And it will be the final extent to which we can tune the performance right? If there is still a way give me some tips to enhance the query perfor

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

2018-05-21 Thread Abbas
Sure thing. Base 60 or Sexagesimal is the numerical system used for measuring time (1 hour equals to 60 minutes and so on). But this case is even simpler, so without going into much detail about bases, you're mapping between two sets of numbers: 0 -> 0 .15 -> .25 .30 -> .50 .45 -> .75 From wo

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

2018-05-21 Thread David G. Johnston
On Mon, May 21, 2018 at 6:39 AM, pavan95 wrote: > Hi Abbas, > > Thanks for your valuable suggestions. To my surprise I got the same output > as what I have executed before. > > But unfortunately I'm unable to understand the logic of the code, in > specific what is base 60 number? The used data ty

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

2018-05-21 Thread pavan95
Hi Abbas, Thanks for your valuable suggestions. To my surprise I got the same output as what I have executed before. But unfortunately I'm unable to understand the logic of the code, in specific what is base 60 number? The used data type for "effort_hours" column is 'double precision'. Kindly

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

2018-05-21 Thread Abbas
Hi. Basically you want to convert a base 60 number to a decimal. So you don't need conditionals. See if this works for you: SELECT floor(effort_hours) + ( (effort_hours - floor(effort_hours)) / 0.6 ) from tms_timesheet_details detail , tms_wsr_header header where wsr_header_id=header.id and w

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

2018-05-21 Thread pavan95
Hi mlunon, A great thanks for your timely response. And yes it worked when I rewritten the query. The query got enhanced with approximate of 1000 planner seeks. You can find it from the explain plan below: amp_test=# explain select sum ( CASE MOD(cast(effort_hours as decimal),1) WHEN 0.4

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

2018-05-21 Thread mlunnon
pavan95 wrote > Hi all, > > Hope my mail finds you in good time. I had a problem with a query which is > hitting the production seriously. > The below is the sub part of the query for which I cannot reduce the CPU > cost. > > Please check and verify whether I'm doing wrong or whether that type i