Re: [HACKERS] Allowing extended stats on foreign and partitioned tables - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: [HACKERS] Allowing extended stats on foreign and partitioned tables
Date
Msg-id CAFjFpRcJntzyR8E6GXqRk3Fa_s_Pw=gmANc_bYVjAF=QCkD_ww@mail.gmail.com
Whole thread Raw
In response to [HACKERS] Allowing extended stats on foreign and partitioned tables  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: [HACKERS] Allowing extended stats on foreign and partitionedtables  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
This isn't exactly about this particular thread. But I noticed, that
after we introduced RELKIND_PARTITIONED_TABLE, we required to change a
number of conditions to include this relkind. We missed some places in
initial commits and fixed those later. I am wondering whether we
should creates macros clubbing relevant relkinds together based on the
purpose of the tests e.g. IS_RELKIND_HAS_STORAGE(). When a new relkind
is added, one can examine these macros to check whether the new
relkind fits in the given macro. If all those macros are placed
together, there is a high chance that we will not miss any place in
the initial commit itself.

For example, if we had a macro IS_RELKIND_WITH_STATS defined as
#define IS_RELKIND_WITH_STATS(relkind) \
((relkind) == RELKIND_RELATION || \
(relkind) == RELKIND_MATVIEW)

and CreateStatistics() and getExtendedStatistics() had following conditions
if (!IS_RELKIND_WITH_STATS(rel->rd_rel->relkind)) and if
(!IS_RELKIND_WITH_STATS(tabinfo->relkind)) resp. The patch would be
just adding
(relkind) == RELKIND_FOREIGN_TABLE || \
(relkind) == RELKIND_PARTITIONED_TABLE)

to that macro without requiring to find out where all we need to add
those two relkinds for statistics purposes.

On Mon, Apr 10, 2017 at 3:09 PM, David Rowley
<david.rowley@2ndquadrant.com> wrote:
> While reviewing extended stats I noticed that it was possible to
> create extended stats on many object types, including sequences. I
> mentioned that this should be disallowed. Statistics were then changed
> to be only allowed on plain tables and materialized views.
>
> This should be relaxed again to allow anything ANALYZE is allowed on.
>
> The attached does this.
>
> --
>  David Rowley                   http://www.2ndQuadrant.com/
>  PostgreSQL Development, 24x7 Support, Training & Services
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>



-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: [HACKERS] pg_stats_ext view does not seem all that useful
Next
From: Greg Stark
Date:
Subject: Re: [HACKERS] Proposal: Local indexes for partitioned table