From: Kotapati, Anil <Anil_Kotapati@comcast.com>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Cc: Kossi, Edem <Edem_Kossi@comcast.com>
Cc: Yadav, Rahul <Rahul_Yadav2@comcast.com>
Cc: Mukherjee, Pallavi (Contractor) <Pallavi_Mukherjee@comcast.com>
Subject: Help with tuning slow query
Date: Fri, 18 May 2018 20:32:55 +0000
Message-ID: <0AA18957-DDD4-413C-AE3A-2D3FD5EF0028@comcast.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: Anil_Kotapati@comcast.com, Edem_Kossi@comcast.com, Rahul_Yadav2@comcast.com, Pallavi_Mukherjee@comcast.com
Subject: Re: Help with tuning slow query
In-Reply-To: <0AA18957-DDD4-413C-AE3A-2D3FD5EF0028@comcast.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox