• Tomas Vondra's avatar
    Pass all scan keys to BRIN consistent function at once · a1c649d8
    Tomas Vondra authored
    This commit changes how we pass scan keys to BRIN consistent function.
    Instead of passing them one by one, we now pass all scan keys for a
    given attribute at once. That makes the consistent function a bit more
    complex, as it has to loop through the keys, but it does allow more
    elaborate opclasses that can use multiple keys to eliminate ranges much
    more effectively.
    
    The existing BRIN opclasses (minmax, inclusion) don't really benefit
    from this change. The primary purpose is to allow future opclases to
    benefit from seeing all keys at once.
    
    This does change the BRIN API, because the signature of the consistent
    function changes (a new parameter with number of scan keys). So this
    breaks existing opclasses, and will require supporting two variants of
    the code for different PostgreSQL versions. We've considered supporting
    two variants of the consistent, but we've decided not to do that.
    Firstly, there's another patch that moves handling of NULL values from
    the opclass, which means the opclasses need to be updated anyway.
    Secondly, we're not aware of any out-of-core BRIN opclasses, so it does
    not seem worth the extra complexity.
    
    Bump catversion, because of pg_proc changes.
    
    Author: Tomas Vondra <tomas.vondra@postgresql.org>
    Reviewed-by: default avatarAlvaro Herrera <alvherre@alvh.no-ip.org>
    Reviewed-by: default avatarMark Dilger <hornschnorter@gmail.com>
    Reviewed-by: default avatarAlexander Korotkov <aekorotkov@gmail.com>
    Reviewed-by: default avatarJohn Naylor <john.naylor@enterprisedb.com>
    Reviewed-by: default avatarNikita Glukhov <n.gluhov@postgrespro.ru>
    Discussion: https://postgr.es/m/c1138ead-7668-f0e1-0638-c3be3237e812@2ndquadrant.com
    a1c649d8
brin_inclusion.c 24.2 KB