-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
type/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.
Description
Enhancement
Currently, TiDB allocation cause too much burden to the Go GC, and slow down the program.
Prepare plan cache can help a lot to reduce the allocation, unfortunately we still can not take full advantage of it.
I reported this issue #26868 in the past.
@qw4990 and @Reminiscent is handling it and we wish to make it GA soon.
Prepare plan cache ranks top1 in reducing the allocation.
So after that, I find chunk allocation also accounts a lot.
If we can reuse the chunk column, it may reduce the object allocation.
Chunk columns are feasible for reuse, as you can see they are fix sized depending on the field type, and there is no complex structure in it, only slice of bytes:
Lines 63 to 84 in 955274f
| type Column struct { | |
| length int | |
| nullBitmap []byte // bit 0 is null, 1 is not null | |
| offsets []int64 // used for varLen column. Row i starts from data[offsets[i]] | |
| data []byte | |
| elemBuf []byte | |
| } | |
| // NewColumn creates a new column with the specific type and capacity. | |
| func NewColumn(ft *types.FieldType, cap int) *Column { | |
| return newColumn(getFixedLen(ft), cap) | |
| } | |
| func newColumn(typeSize, cap int) *Column { | |
| var col *Column | |
| if typeSize == varElemLen { | |
| col = newVarLenColumn(cap) | |
| } else { | |
| col = newFixedLenColumn(typeSize, cap) | |
| } | |
| return col | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.