Re: *Regarding brin_index on required column of the table

From: Alban Hertroys <haramrae(at)gmail(dot)com>
To: Durgamahesh Manne <maheshpostgres9(at)gmail(dot)com>
Cc: andreas(at)a-kretschmer(dot)de, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: *Regarding brin_index on required column of the table
Date: 2018-09-21 19:08:29
Message-ID: ADAB2B68-7FD7-4E3D-A7CE-F5D07A43A93A@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On 21 Sep 2018, at 17:49, Durgamahesh Manne <maheshpostgres9(at)gmail(dot)com> wrote:
>
> <Query>

Considering how hard you try to get rid of duplicates, I'm quite convinced that you're at least short a few join conditions. Getting rid of duplicates early has the added benefit of having to aggregate fewer rows, which should drastically improve the performance of this query.

In addition, your approach of using both distinct and group by raises a red flag that you're fighting symptoms (most likely: duplicate results) without understanding their causes. I can't think of a single situation where both are justified in the same (sub-)query.

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Carlo Pires 2018-09-21 19:39:46 Share TLS connections with different databases.
Previous Message Mark Williams 2018-09-21 17:35:28 PostgreSQl, PHP and IIS