| From: | "Kotapati, Anil" <Anil_Kotapati(at)comcast(dot)com> |
|---|---|
| To: | "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
| Cc: | "Kossi, Edem" <Edem_Kossi(at)comcast(dot)com>, "Yadav, Rahul" <Rahul_Yadav2(at)comcast(dot)com>, "Mukherjee, Pallavi (Contractor)" <Pallavi_Mukherjee(at)comcast(dot)com> |
| Subject: | Help with tuning slow query |
| Date: | 2018-05-18 20:32:55 |
| Message-ID: | 0AA18957-DDD4-413C-AE3A-2D3FD5EF0028@comcast.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
Hi Team,
We are facing issues with one of our query, when we use order by count it is taking lot of time to execute the query. To be precise it is taking 9 min to execute the query from table which has ~220 million records. Is there a way to make this query run faster and efficiently using order by count. Below is the query which I’m trying to run
Select account_number, sum(count_of_event) as "error_count"
FROM event_daily_summary
group by account_number,event_date,process_name
having event_date >= '2018-05-07'
and process_name='exp90d_xreerror'
order by sum(count_of_event) desc
limit 5000
Thanks,
Anil
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Justin Pryzby | 2018-05-19 15:57:49 | Re: Help with tuning slow query |
| Previous Message | Mark Kirkwood | 2018-05-12 05:19:13 | Re: Latest advice on SSD? |