cpimport for MariaDB Enterprise ColumnStore 6
MariaDB Enterprise ColumnStore 6 includes the
cpimport utility, which efficiently bulk loads data into ColumnStore tables.
If the LOAD DATA [ LOCAL ] INFILE or INSERT INTO .. SELECT FROM .. statements are used with a ColumnStore table, MariaDB Enterprise ColumnStore 6 transforms the operation into a bulk load that uses
cpimport by default.
Reference material is available for MariaDB Enterprise ColumnStore 6.
MariaDB Enterprise ColumnStore 6 is included with MariaDB Enterprise Server 10.6.
The syntax for
$ cpimport [OPTION ...] DATABASE_NAME TABLE_NAME [INPUT_FILE]
MariaDB Enterprise ColumnStore 6 includes the
cpimport tool for bulk data loads:
Bypasses the SQL layer to decrease overhead
Does not block read queries
Requires a write metadata lock on the table, which can be monitored with the METADATA_
LOCK_ INFO plugin
Appends the new data to the table. While the bulk load is in progress, the newly appended data is temporarily hidden from queries. After the bulk load is complete, the newly appended data is visible to queries.
Inserts each row in the order the rows are read from the source file. Users can optimize data loads for Enterprise ColumnStore's automatic partitioning by loading presorted data files.
Supports parallel distributed bulk loads
Imports data from text files
Imports data from binary files
Imports data from standard input (
For additional information, see "Data Loading with cpimport".
cpimport Options for MariaDB Enterprise ColumnStore 6
I/O library read buffer size (in bytes)
Number of read buffers
Escape character used in conjunction with 'enclosed by'
Application read buffer size(in bytes)
Print different level(1-3) debug message
Enclosed by character if field values are enclosed.
Max number of allowable error per table per PM
Data file directory path.
S3 Region (for S3 imports)
S3 Hostname (for S3 imports, Amazon's S3 default)
Print this message.
Import binary data; how to treat NULL values:
Print extended info to console in Mode 3.
Job ID. In simple usage, default is the table OID.
S3 Authentication Secret (for S3 imports)
Directory for the output .err and .bad files.
Name of import file to be loaded, relative to -f path,
NullOption (0-treat the string NULL as data (default);
List of PMs ex: -P 1,2,3. Default is all PMs.
Path for XML job description file.
Batch Quantity, Number of rows distributed per batch in Mode 1
Number of readers.
Treat string truncations as errors.
'c' is the delimiter between column values.
Timezone used for TIMESTAMP datatype.
S3 Bucket (for S3 imports)
Number of parsers.
S3 Authentication Key (for S3 imports)
To see options supported in other versions, see "cpimport Options by MariaDB Enterprise ColumnStore Version".
Batch Insert Mode
MariaDB Enterprise ColumnStore 6 enables batch insert mode by default.
When batch insert mode is enabled, MariaDB Enterprise ColumnStore, MariaDB Enterprise ColumnStore has special handling for the following statements:
Enterprise ColumnStore uses the following rules:
If the statement is executed outside of a transaction, Enterprise ColumnStore loads the data using
cpimport. It executes
cpimportusing a wrapper called
If the statement is executed inside of a transaction, Enterprise ColumnStore loads the data using the DML interface, which is slower.
Batch insert mode can be disabled by setting the columnstore_
When MariaDB Enterprise ColumnStore 6 performs a bulk data load, it appends data to the table in the order in which the data is read. Appending data reduces the I/O requirements of bulk data loads, so that larger data sets can be loaded very efficiently.
While the bulk load is in progress, the newly appended data is temporarily hidden from queries.
After the bulk load is complete, the newly appended data is visible to queries.
Sort the Input File
When MariaDB Enterprise ColumnStore 6 performs a bulk data load, it appends data to the table in the order in which the data is read.
The order of data can have a significant effect on performance with Enterprise ColumnStore, so it can be helpful to sort the data in the input file prior to importing it.
For additional information, see "Load Ordered Data in Proper Order".
MariaDB Enterprise ColumnStore 6 requires a write metadata lock (MDL) on the table when a bulk data load is performed with cpimport.
When a bulk data load is running:
Read queries will not be blocked.
Write queries and concurrent bulk data loads on the same table will be blocked until the bulk data load operation is complete, and the write metadata lock on the table has been released.
The write metadata lock (MDL) can be monitored with the METADATA_
LOCK_. INFO plugin
In MariaDB Enterprise ColumnStore 6, the
cpimport tool writes bulk load logs to
Import from Text Files
cpimport tool can import data from a text file if a file is provided as an argument after the database and table name.
For example, to import the file
inventory-products.txt into the
products table in the
$ sudo cpimport \ inventory products \ inventory-products.txt
Import from Remote MariaDB Server
cpimport tool can import data from a remote MariaDB Server. You can use MariaDB Client to query the table using the SELECT statement, and then pipe the results into the standard input of the
$ mariadb --quick \ --skip-column-names \ --execute="SELECT * FROM inventory.products" \ | cpimport -s '\t' inventory products
Import from an S3 Bucket
cpimport tool can import data from a file stored in a remote S3 bucket. You can use the AWS CLI to copy the file from S3, and then pipe the contents into the standard input of the
$ aws s3 cp --quiet s3://columnstore-test/inventory-products.csv - \ | cpimport -s ',' inventory products
Set the Field Delimiter
The default field delimiter for the
cpimport tool is a pipe (
If your data file uses a different field delimiter, you can specify the field delimiter with the
For a TSV (tab-separated values) file:
$ sudo cpimport -s '\t' \ inventory products \ inventory-products.tsv
For a CSV (comma-separated values) file:
$ sudo cpimport -s ',' \ inventory products \ inventory-products.csv
Set the Quoting Style
By default, the
cpimport tool does not expect fields to be quoted.
If your data file uses quotes around fields, you can specify the quote character with the
To load a TSV (tab-separated values) file that uses double quotes:
$ sudo cpimport -s '\t' -E '"' \ inventory products \ inventory-products.tsv
To load a CSV (comma-separated values) file that uses optional single quotes:
$ sudo cpimport -s ',' -E "'" \ inventory products \ inventory-products.csv