The “table” function in DolphinDB can create tables.
table(capacity:size, colNames, colTypes)
capacity is a positive integer, indicating the memory (in the number of records) allocated by the system for the table when the table is built. When the number of records exceeds the capacity, the system will first allocate a new memory space of 1.2~2 times the capacity, then copy the data to the new memory space, and finally release the original memory. For larger tables, the memory usage of such operations will be very high. Therefore, it is recommended to allocate a reasonable capacity in advance when creating a memory table.
Execute following codes:
colName = ["time", "x"]
colType = ["timestamp", "int"]
t1 = table(1000000:0, colName, colType);
t2 = table(100:0, colName, colType);
t3 = table(colName, colType);
pnodeRun(objs)
name |
type |
form |
rows |
columns |
bytes |
shared |
extra |
node |
t1 |
BASIC |
TABLE |
0 |
2 |
12000312 |
false |
|
datanode1 |
t2 |
BASIC |
TABLE |
0 |
2 |
1512 |
false |
|
datanode1 |
t3 |
BASIC |
TABLE |
2 |
2 |
568 |
false |
|
datanode1 |
The occupied memory size is related to the capacity set when the table is created.