Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sql/analyzer/costed_index_scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ func (c *indexCoster) updateBest(s sql.Statistic, hist []sql.HistogramBucket, fd
{
// if no unique keys, prefer equality over ranges
bestConst, bestIsNull := c.getConstAndNullFilters(c.bestFilters)
cmpConst, cmpIsNull := c.getConstAndNullFilters(c.bestFilters)
cmpConst, cmpIsNull := c.getConstAndNullFilters(filters)
if cmpConst.Len() > bestConst.Len() {
update = true
return
Expand Down
12 changes: 3 additions & 9 deletions sql/memo/memo.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,13 @@ func (m *Memo) OptimizeRoot() error {
// the same subgroup dependencies. After finding the best implementation
// for a particular group, we fix the best plan for that group and recurse
// into its parents.
// TODO: we should not have to cost every plan, sometimes there is a provably
// TODO: we should not have to cost every plan, sometimes there is a probably
// best case implementation
func (m *Memo) optimizeMemoGroup(grp *ExprGroup) error {
if grp.Done {
return nil
}

var err error
n := grp.First
if _, ok := n.(SourceRel); ok {
// We should order the search bottom-up so that physical operators
Expand All @@ -425,7 +424,7 @@ func (m *Memo) optimizeMemoGroup(grp *ExprGroup) error {
for n != nil {
var cost float64
for _, g := range n.Children() {
err = m.optimizeMemoGroup(g)
err := m.optimizeMemoGroup(g)
if err != nil {
return err
}
Expand All @@ -437,15 +436,13 @@ func (m *Memo) optimizeMemoGroup(grp *ExprGroup) error {
}

if grp.RelProps.Distinct.IsHash() {
var dCost float64
if sortedInputs(n) {
n.SetDistinct(SortedDistinctOp)
} else {
n.SetDistinct(HashDistinctOp)
d := &Distinct{Child: grp}
dCost = float64(statsForRel(m.Ctx, d).RowCount())
relCost += float64(statsForRel(m.Ctx, d).RowCount())
}
relCost += dCost
} else {
n.SetDistinct(NoDistinctOp)
}
Expand All @@ -457,9 +454,6 @@ func (m *Memo) optimizeMemoGroup(grp *ExprGroup) error {
}

grp.Done = true
if err != nil {
return err
}
return nil
}

Expand Down
3 changes: 0 additions & 3 deletions sql/rowexec/ddl_iters.go
Original file line number Diff line number Diff line change
Expand Up @@ -2366,9 +2366,6 @@ func (b *BaseBuilder) executeAlterAutoInc(ctx *sql.Context, n *plan.AlterAutoInc
if !ok {
return plan.ErrInsertIntoNotSupported.New()
}
if err != nil {
return err
}

autoTbl, ok := insertable.(sql.AutoIncrementTable)
if !ok {
Expand Down
Loading