Please work through the Slow Query wiki page and try to provide as much information as possible. It's too hard to try to help if each communication includes only a fraction of the requested information. On Thu, Jun 10, 2021 at 04:33:51PM +0500, Haseeb Khan wrote: > PFB the query and there are many other queries like these > > select > pd.gender, > count(1) as dispensation_counts > from cdss_wasfaty.dispensation_fact df > inner join cdss_wasfaty.patient_dim pd > on df.patient_key = pd.patient_key > inner join cdss_wasfaty.date_dim date_dim > on df.dispensation_date_key = date_dim.date_key > and date_dim.year IN (2020) > group by pd.gender > > On Thu, Jun 10, 2021 at 2:48 PM Justin Pryzby <pryzby@xxxxxxxxxxxxx> wrote: > > > Can you give an example of a query that performed poorly? > > > > Send the query, and its explain (analyze,buffers,settings) for the query, > > and schema for the relevant queries. > > > > > > https://wiki.postgresql.org/wiki/Slow_Query_Questions -- Justin Pryzby System Administrator Telsasoft +1-952-707-8581