Re: JOIN on partitions is very slow

From: daya airody <daya(dot)airody(at)gmail(dot)com>
To: Michael Lewis <mlewis(at)entrata(dot)com>
Cc: Pgsql Performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: JOIN on partitions is very slow
Date: 2020-03-23 07:40:19
Message-ID: CAFg0VMAkUn7AJuNo28sm2zXcsJUXKm+ACD2CmZZxZ801PZSiPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Yes. I can tweak the query. Version of postgres is 9.5.15. I have about 20
partitions for company_sale_account table.
I do have an index on company name.

I need to use DISTINCT as i need to remove the duplicates.

Thanks for your time.

On Sun, Mar 22, 2020 at 11:38 PM Michael Lewis <mlewis(at)entrata(dot)com> wrote:

> Are you able to tweak the query or is that generated by an ORM? What
> version of Postgres? Which configs have you changed from default? How many
> partitions do you have? Is there an index on company name?
>
> Anytime I see distinct keyword, I expect it to be a performance bottleneck
> and wonder about rewriting the query. Even just using group by can be much
> faster because of how it gets executed.
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Ronnie S 2020-03-23 14:18:27 Re: Partition Pruning (Hash Partitions) Support for DELETEs in PostgreSQL 11 and 12
Previous Message Justin Pryzby 2020-03-23 04:10:41 Re: Partition Pruning (Hash Partitions) Support for DELETEs in PostgreSQL 11 and 12