Thread

  1. Re: Use merge-based matching for MCVs in eqjoinsel

    Ilia Evdokimov <ilya.evdokimov@tantorlabs.com> — 2025-09-04T11:05:50Z

    On 03.09.2025 23:26, Tom Lane wrote:
    > Ilia Evdokimov <ilya.evdokimov@tantorlabs.com> writes:
    >> I’ve attached v3 of the patch. This version adds a check for NULL values
    >> when comparing MCV entries, ensuring correctness in edge cases.
    > Um ... what edge cases would those be?  We do not put NULL into
    > MCV arrays.
    
    
    You're right - MCV arrays never contain NULLs. However, comparing two 
    MCV values could theoretically return NULL, even though this is very 
    unlikely. This check existed even before my changes, and similar checks 
    are used in other selectivity-estimation functions in 'selfuncs.c'.
    
    ...
    fcinfo->isnull = false;
    fresult = FunctionCallInvoke(fcinfo);
    if (!fcinfo->isnull && DatumGetBool(fresult))
    ...
    
    By "edge cases" I was referring to this situation; I probably did not 
    choose the best wording.
    
    --
    Best regards,
    Ilia Evdokimov,
    Tantor Labs LLC,
    https://tantorlabs.com