mvccTable
Syntax
mvccTable(X, [X1], [X2], .....)
or
mvccTable(capacity:size, colNames, colTypes, [path], [tableName])
Arguments
For the first scenario:
X, X1, X2 ...are vectors.
For the second scenario:
capacity is the amount of memory (in terms of the number of rows) allocated to the table. When the number of rows exceeds capacity, the system will first allocate memory of 1.2~2 times of capacity, copy the data to the new memory space, and release the original memory. For large tables, these steps may use significant amount of memory.
size is an integer no less than 0 indicating the initial size (in terms of the number of rows) of the table. If size=0, create an empty table. If size>0, the initialized values are determined by defaultValues.
colNames is a string vector of column names.
colTypes is a string vector of column types.
path is a string indicating the absolute path of the table on disk. The DFS path is not supported.
tableName is a string indicating the name of the table on disk.
Details
Create an MVCC (Multi Version Concurrency Control) table. When appending, updating or deleting rows of a table, another version of the table is created so that concurrent read will not be blocked. The mvcc table is optimal for the use case with frequent read and append, but few update and delete operations.
-
The MVCC table does not support
addColumn
,dropColumns!
,replaceColumn!
,reorderColumns!
,upsert!
,drop
,erase!
.
Examples
Example. Create an MVCC table by two methods:
Method 1:
id=`XOM`GS`AAPL
x=102.1 33.4 73.6
mvccTable(id, x);
id | x |
---|---|
XOM | 102.1 |
GS | 33.4 |
AAPL | 73.6 |
Method 2:
mvccTable(200:10, `name`id`value, [STRING,INT,DOUBLE],"C:/DolphinDB/Data","t1");
name | id | value |
---|---|---|
0 | 0 | |
0 | 0 | |
0 | 0 | |
0 | 0 | |
0 | 0 | |
0 | 0 | |
0 | 0 | |
0 | 0 | |
0 | 0 | |
0 | 0 |
There will be files named t1.tbl, t1.sym and a folder named t1 under path C:/DolphinDB/Data. You should delete all these files before deleting a disk table.