Skip to content

Commit

Permalink
tree: fix tuple encoding performance regression
Browse files Browse the repository at this point in the history
This commit fixes a performance regression in pgwire encoding of tuples
introduced in #95009.

Informs #98306

Epic: None

Release note: None
  • Loading branch information
mgartner committed Mar 15, 2023
1 parent 53e8c66 commit 20a5fb7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/sql/sem/tree/pgwire_encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@ func (d *DTuple) pgwireFormat(ctx *FmtCtx) {
// string printer called pgwireFormatStringInTuple().
ctx.WriteByte('(')
comma := ""
tc := d.ResolvedType().TupleContents()
for i, v := range d.D {
ctx.WriteString(comma)
t := v.ResolvedType()
if tc := d.ResolvedType().TupleContents(); i < len(tc) {
var t *types.T
if i < len(tc) {
t = tc[i]
} else {
t = v.ResolvedType()
}
switch dv := UnwrapDatum(nil, v).(type) {
case dNull:
Expand Down

0 comments on commit 20a5fb7

Please sign in to comment.