Re: Operator Classes and ANALYZE - Mailing list pgsql-bugs

From Rusty Conover
Subject Re: Operator Classes and ANALYZE
Date
Msg-id 3AD4035D-6929-4347-B272-FBF7378EB1E4@infogears.com
Whole thread Raw
In response to Re: Operator Classes and ANALYZE  ("Simon Riggs" <simon@2ndquadrant.com>)
Responses Re: Operator Classes and ANALYZE
List 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

pgsql-bugs by date:

Previous
From: "Simon Riggs"
Date:
Subject: Re: Operator Classes and ANALYZE
Next
From: David Fetter
Date:
Subject: Re: Operator Classes and ANALYZE