• unknown's avatar
    MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions... · 8704113b
    unknown authored
    MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions in WHERE clause of UPDATE or DELETE statements
    
    Analysis
    The reason for the less efficient plan was result of a prior design decision -
    to limit the eveluation of constant expressions during optimization to only
    non-expensive ones. With this approach all stored procedures were considered
    expensive, and were not evaluated during optimization. As a result, SPs didn't
    participate in range optimization, which resulted in a plan with table scan
    rather than index range scan.
    
    Solution
    Instead of considering all SPs expensive, consider expensive only those SPs
    that are non-deterministic. If an SP is deterministic, the optimizer will
    checj if it is constant, and may eventually evaluate it during optimization.
    
    8704113b
sp.test 178 KB