CSV Overview

The CSV Storage Engine stores data in comma-separated values format text files, making it easy to exchange data with other applications.

The CSV Storage Engine can read and append to files stored in CSV (comma-separated-values) format.

The CSV storage engine and logging to tables

The CSV storage engine is the default storage engine when using logging of SQL queries to tables.

mysqld --log-output=table

CSV Storage Engine files

When you create a table using the CSV storage engine, three files are created:

  • <table_name>.frm

  • <table_name>.CSV

  • <table_name>.CSM

The .frm file is the table format file.

The .CSV file is a plain text file. Data you enter into the table is stored as plain text in comma-separated-values format.

The .CSM file stores metadata about the table such as the state and the number of rows in the table.

Limitations

  • CSV tables do not support indexing.

  • CSV tables cannot be partitioned.

  • Columns in CSV tables must be declared as NOT NULL.

  • The original CSV-format does not enable IETF-compatible parsing of embedded quote and comma characters. From MariaDB 10.1.8, it is possible to do so by setting the IETF_QUOTES option when creating a table.

Examples

Forgetting to add NOT NULL:

Creating, inserting and selecting:

Viewing in a text editor:

See Also

This page is licensed: CC BY-SA / Gnu FDL

Last updated

Was this helpful?