Skip to content
  • Maheedhar PV's avatar
    f4d5197f
    WL#14315: Backport wl#13929 to 5.7 (Introduce new optimizer switch to · f4d5197f
    Maheedhar PV authored
    disable limit optimization)
    
    Bug#31686878 - BACKPORT MAIN BUG 30348211 TO RELEASE 5.7
    
    The optimization to switch from a non-ordering index to an ordering
    index for group by and order by when there is a limit clause makes wrong
    decisions for some queries for various reasons.
    
    This patch introduces an optimizer switch that enables users to disable
    this optimization if the switch to ordering index results in a bad plan.
    
    The name of the switch is "prefer_ordering_index". By default the switch
    is on which means if an ordering index is found to be better than an
    already chosen plan then optimizer will switch to the ordering
    index. However if "prefer_ordering_index" is set to off, the switch to
    ordering index because of the "limit optimization" will not happen,
    resulting in optimizer picking the original plan which could have been
    using a filtering index.
    
    Change-Id: I511c586ac820cea8a63156299c08ee2213295130
    f4d5197f
    WL#14315: Backport wl#13929 to 5.7 (Introduce new optimizer switch to
    Maheedhar PV authored
    disable limit optimization)
    
    Bug#31686878 - BACKPORT MAIN BUG 30348211 TO RELEASE 5.7
    
    The optimization to switch from a non-ordering index to an ordering
    index for group by and order by when there is a limit clause makes wrong
    decisions for some queries for various reasons.
    
    This patch introduces an optimizer switch that enables users to disable
    this optimization if the switch to ordering index results in a bad plan.
    
    The name of the switch is "prefer_ordering_index". By default the switch
    is on which means if an ordering index is found to be better than an
    already chosen plan then optimizer will switch to the ordering
    index. However if "prefer_ordering_index" is set to off, the switch to
    ordering index because of the "limit optimization" will not happen,
    resulting in optimizer picking the original plan which could have been
    using a filtering index.
    
    Change-Id: I511c586ac820cea8a63156299c08ee2213295130
Loading