• Tom Lane's avatar
    Simplify the planner's new representation of indexable clauses a little. · 8fd3fdd8
    Tom Lane authored
    In commit 1a8d5afb, I thought it'd be a good idea to define
    IndexClause.indexquals as NIL in the most common case where the given
    clause (IndexClause.rinfo) is usable exactly as-is.  It'd be more
    consistent to define the indexquals in that case as being a one-element
    list containing IndexClause.rinfo, but I thought saving the palloc
    overhead for making such a list would be worthwhile.
    
    In hindsight, that was a great example of "premature optimization is the
    root of all evil": it's complicated everyplace that needs to deal with
    the indexquals, requiring duplicative code to handle both the simple
    case and the not-simple case.  I'd initially found that tolerable but
    it's getting less so as I mop up some areas that I'd not touched in
    1a8d5afb.  In any case, two more pallocs during a planner run are
    surely at the noise level (a conclusion confirmed by a bit of
    microbenchmarking).  So let's change this decision before it becomes
    set in stone, and insist that IndexClause.indexquals always be a valid
    list of the actual index quals for the clause.
    
    Discussion: https://postgr.es/m/24586.1550106354@sss.pgh.pa.us
    8fd3fdd8
selfuncs.c 206 KB