Importing and Exporting
Bulk data manipulation is a common activity in data analytics. This section
provide details on the various ways of moving data into and out of MonetDB.
Importing data
The best way to import data depends on its source and on the amount of data.
- INSERT INTO table VALUES
- Every SQL-based application understands INSERT INTO. For moderate amounts of
data its performance is sufficient as long as you take care to avoid some pitfalls.
- COPY INTO table FROM file
- Many applications can export data as text files, for example with comma- or tab
separated records or with fixed width records. Loading these using COPY INTO is
significantly faster then the equivalent series of INSERTs. Generally this is the
preferred way of bulk loading data into MonetDB.
- COPY BINARY INTO table FROM files
- Loading data from binary files is even faster but the binary files require
more effort to create.
- COPY LOADER INTO table FROM python_function
- Data can also be generated on the fly using a Python program running
inside the database server. This program can make up the data on the fly
or extract it from an arbitrary external source.
Exporting data
- COPY select query INTO [BINARY] files
- This statement can be used to export data to a text file or to
binary files.