Skip to content

Commit

Permalink
Don't use index hint if there are pushdown expressions
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Jan 31, 2025
1 parent 03c8168 commit 3632c05
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion go/vt/vttablet/tabletserver/vstreamer/rowstreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ func (rs *rowStreamer) buildSelect(st *binlogdatapb.MinimalTable) (string, error
// do a FILESORT of all the results. This index should contain all
// of the PK columns which are used in the ORDER BY clause below.
var indexHint string
if st.PKIndexName != "" {
// If we're pushing down any expressions, we need to let the optimizer
// choose the best index to use.
if st.PKIndexName != "" && len(rs.plan.whereExprsToPushDown) == 0 {
escapedPKIndexName, err := sqlescape.EnsureEscaped(st.PKIndexName)
if err != nil {
return "", err
Expand Down

0 comments on commit 3632c05

Please sign in to comment.