Re: Why is n_distinct always -1 for range types?

From: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Why is n_distinct always -1 for range types?
Date: 2013-09-25 17:53:17
Message-ID: CAEYLb_Vi4=BVZ1TvSzO2vZSSkCd3p83StO8dcSuRHHymaOpkTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, Sep 19, 2013 at 1:47 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> 4. n-distinct will still be listed as -1 (unique) for the column.
>
> Why?

Because of this:

https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/rangetypes_typanalyze.c#L205

We only collect and use histograms of lower and upper bounds for range
types, and the fraction of empty ranges.

--
Regards,
Peter Geoghegan

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Janes 2013-09-25 18:17:51 Re: Planner performance extremely affected by an hanging transaction (20-30 times)?
Previous Message Andres Freund 2013-09-25 17:53:13 Re: Planner performance extremely affected by an hanging transaction (20-30 times)?