• David Rowley's avatar
    Allow estimate_num_groups() to pass back further details about the estimation · ed934d4f
    David Rowley authored
    Here we add a new output parameter to estimate_num_groups() to allow it to
    inform the caller of additional, possibly useful information about the
    estimation.
    
    The new output parameter is a struct that currently contains just a single
    field with a set of flags.  This was done rather than having the flags as
    an output parameter to allow future fields to be added without having to
    change the signature of the function at a later date when we want to pass
    back further information that might not be suitable to store in the flags
    field.
    
    It seems reasonable that one day in the future that the planner would want
    to know more about the estimation. For example, how many individual sets
    of statistics was the estimation generated from?  The planner may want to
    take that into account if we ever want to consider risks as well as costs
    when generating plans.
    
    For now, there's only 1 flag we set in the flags field.  This is to
    indicate if the estimation fell back on using the hard-coded constants in
    any part of the estimation. Callers may like to change their behavior if
    this is set, and this gives them the ability to do so.  Callers may pass
    the flag pointer as NULL if they have no interest in obtaining any
    additional information about the estimate.
    
    We're not adding any actual usages of these flags here.  Some follow-up
    commits will make use of this feature.  Additionally, we're also not
    making any changes to add support for clauselist_selectivity() and
    clauselist_selectivity_ext().  However, if this is required in the future
    then the same struct being added here should be fine to use as a new
    output argument for those functions too.
    
    Author: David Rowley
    Discussion: https://postgr.es/m/CAApHDvqQqpk=1W-G_ds7A9CsXX3BggWj_7okinzkLVhDubQzjA@mail.gmail.com
    ed934d4f
indxpath.c 120 KB