From: Simon Riggs <simon@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: get_relation_stats_hook()
Date: Thu, 26 Jun 2008 17:02:50 +0100
Message-ID: <1214496170.3845.196.camel@ebony.site> (raw)
In-Reply-To: <16415.1214493494@sss.pgh.pa.us>
References: <1214490037.3845.136.camel@ebony.site>
<16415.1214493494@sss.pgh.pa.us>
On Thu, 2008-06-26 at 11:18 -0400, Tom Lane wrote:
> Simon Riggs <simon@2ndquadrant.com> writes:
> > Currently we have a plugin capability for get_relation_info_hook(), but
> > no corresponding capability for statistics info.
>
> > So, all calls to SearchSysCache would be replaced with a call to
> > get_relation_info_hook(), if present.
>
> Surely you didn't mean ALL calls. Please be more specific about what
> you're proposing.
The statistics relation STATRELATT is accessed in a few places in the
planner. Since it is in the syscache it is accessed directly from there.
I would like to add hooks so that stats data can come from somewhere
else other than the syscache for tables, just as we can already do with
get_relation_stats_hook(). These new changes would complete the existing
feature to ensure it is fully usabled in the way originally intended.
In selfunc.c: There are 3 calls to SearchSysCache(STATRELATT,...).
In lsyscache.c: There is 1 call to SearchSysCache(STATRELATT...) in
get_attavgwidth() and 2 calls to SysCacheGetAttr(STATRELATT...) in
get_attstatsslot().
Calls to SearchSysCache(STATRELATT...) would be replaced by a call to an
external module, if present, with a function pointer to
get_relation_stats_hook(). This returns a tuple with stats info about
that relation.
Calls to SysCacheGetAttr(STATRELATT...) would be replaced by a call to
an external module, if present with a function pointer to
get_attribute_stats_hook(). This returns a stats slot.
The call in ANALYZE would not be touched.
--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-patches@postgresql.org
Cc: simon@2ndquadrant.com, tgl@sss.pgh.pa.us, alvherre@commandprompt.com, pgsql-hackers@postgresql.org
Subject: Re: get_relation_stats_hook()
In-Reply-To: <1214496170.3845.196.camel@ebony.site>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox