TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
We can use the pointer receiver to finish the same init as the value receiver using the below code. And there is no need of value copy, costing less memory.
copy
topology
running the tiup playground on my laptop. 1 TiKV, 1 TiDB and 1 PD.
workload
using sysbench to create one database consist of 32 tables. There're 10000 records in each table.
profile
generate the profile using the method below
the heap profile is here The most memory cost is in the fuction
buildValueListOfInsert
, So try to find the memory optimization.In the file
initialize.go
, there are some Init function using the value receiver, like this:We can use the pointer receiver to finish the same init as the value receiver using the below code. And there is no need of value copy, costing less memory. copy