Re: Operator Classes and ANALYZE

From: Rusty Conover <rconover(at)infogears(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Operator Classes and ANALYZE
Date: 2006-11-06 22:54:16
Message-ID: 3AD4035D-6929-4347-B272-FBF7378EB1E4@infogears.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On Nov 6, 2006, at 3:20 PM, Simon Riggs wrote:

> On Mon, 2006-11-06 at 14:47 -0700, Rusty Conover wrote:
>
>> I just
>> want the ANALYZE call to use the index's opclass definitions of = and
>> < if the index is created with a custom operator class that is not
>> the default for the data type.
>
> Which is exactly what the manual specifically says it doesn't do,
> therefore you'll need the analyze_function. That capability was put
> there deliberately to help you out, in this situation.

Since the analyze function is part of the type not the operator class
(making it type specific not operator class specific), it doesn't
appear that it will be able to do what I ask since you can only have
one analyze function per type and its not passed the operator context
for the particular run.

from analyze.h:

/*----------
* ANALYZE builds one of these structs for each attribute (column)
that is
* to be analyzed. The struct and subsidiary data are in
anl_context,
* so they live until the end of the ANALYZE operation.
*
* The type-specific typanalyze function is passed a pointer to this
struct
* and must return TRUE to continue analysis, FALSE to skip analysis
of this
* column. In the TRUE case it must set the compute_stats and
minrows fields,
* and can optionally set extra_data to pass additional info to
compute_stats.
* minrows is its request for the minimum number of sample rows to be
gathered
* (but note this request might not be honored, eg if there are fewer
rows
* than that in the table).
*
*/

I still think this is a deficiency in the analyze function to not use
the operator_class that the index uses when producing statistics for
that index.

Thanks,

Rusty
--
Rusty Conover
InfoGears Inc.
Web: http://www.infogears.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Fetter 2006-11-06 23:10:13 Re: Operator Classes and ANALYZE
Previous Message Simon Riggs 2006-11-06 22:20:54 Re: Operator Classes and ANALYZE