Re: Range types do not display in pg_stats

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Range types do not display in pg_stats
Date: 2013-09-20 01:02:40
Message-ID: CA+TgmoZNZ8NXJcU1M7ApM+BpAJ3R7Dpkp82d72LonH0aVkwppQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 19, 2013 at 4:54 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
>
> create table tstztest( trange tstzrange );
>
> postgres=# insert into tstztest select tstzrange(t, t + interval '1 month')
> from generate_series('2012-01-01'::timestamptz,'2018-01-01','1 month')
> as gs(t);
> INSERT 0 73
> postgres=# analyze tstztest;
> ANALYZE
> postgres=# select * from pg_stats where tablename = 'tstztest';
> schemaname | tablename | attname | inherited | null_frac | avg_width |
> n_distinct | most_common_vals | most_common_freqs | histogram_bounds
> | correlation | most_common_elems | most_common_elem_freqs |
> elem_count_histogram
> ------------+-----------+---------+-----------+-----------+-----------+------------+------------------+-------------------+------------------
> +-------------+-------------------+------------------------+----------------------
> public | tstztest | trange | f | 0 | 22 |
> -1 | | |
> | | | |
>
> Now, there actually *is* a histogram for the column, which you can find
> via pg_statistic. But is shows up as NULL in pg_stats view.
>
> If this is a known issue, we ought to at least add it to the docs.

It probably has to do with the CASE stakind stuff in the definition of
the pg_stats view. Try \d+ pg_stats to see what I mean.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Valentine Gogichashvili 2013-09-20 01:20:02 Re: UTF8 national character data type support WIP patch and list of open issues.
Previous Message Tatsuo Ishii 2013-09-20 00:00:33 Re: Looking for information on our elephant