Exports a table, columns from a table, or query results to delimited files. The files can be read back in using DELIMITED (Parser). Several exporter parameters have corresponding parser parameters, allowing you to change delimiters, null indicators, and other formatting.

You can use an OVER() clause to partition the data before export. You can partition data instead of or in addition to exporting the column data. Partitioning data can improve query performance by enabling partition pruning. See Improving Query Performance.

There are some limitations on the queries you can use in an export statement. See Query Restrictions.

You can export data stored in Vertica in ROS format and data from external tables.

This statement returns the number of rows written and logs information about exported files in a system table. See Monitoring Exports.

During an export to HDFS or an NFS mount point, Vertica writes files to a temporary directory in the same location as the destination and renames the directory when the export is complete. Do not attempt to use the files in the temporary directory. During an export to S3, GCS, or Azure, Vertica writes files directly to the destination path, so you must wait for the export to finish before reading the files. For more information, see Exporting to Object Stores.


EXPORT [ /*+LABEL (label‑string)*/ ] TO DELIMITED ( directory='path'[, param=value [,...] ] 
   [ OVER (over‑clause ) ] AS SELECT query‑expression



Assigns a label to a statement to identify it for profiling and debugging.


The destination directory for the output files. The directory must not exist, and the current user must have permission to write it. The destination can be on any of the following file systems:


Boolean, specifies whether to add a header row to the beginning of each file.

Default: false


Column delimiter character. To produce CSV in accordance with RFC 4180, set the delimiter character to , (comma).

Default: | (vertical bar)


Character that marks the record end.

Default: \n


Character to use to enclose string and date/time data. If you omit this parameter, no character encloses these data types.

Default: '' (empty string)


Character to use to escape values in exported data that must be escaped, including the enclosedBy value.

Default: \ (backslash)

nullAs String to represent null values in the data. If this parameter is included, the exporter exports all null values as this value. Otherwise, the exporter exports null values as zero-length strings.

Format for exported binary data type (BINARY, VARBINARY, and LONG VARBINARY) values, one of the following:

  • Default: Printable ASCII characters where possible and escaped octal representations of the non-printable bytes. The DELIMITED parser reads this format.
  • Hex: Base 16 (hexadecimal) representation; value is preceded by '0x' and bytes are not escaped.
  • Octal: Base 8 (octal) representation, without escaping.
  • Bitstring: Binary representation, without escaping.

For example, the value a\000b\001c can be exported as follows:

  • Default (assuming an escape character of \): a\\000b\\001c
  • Hex: 0x6100620163
  • Octal: 141000142001143
  • Bitstring: 0110000100000000011000100000000101100011

Compression type, one of:

  • Uncompressed (default)
  • BZip
  • GZip

Output file extension. If using compression, a compression-specific extension such as .bz2 is appended.

Default: csv


The maximum file size of a single output file. This value is a hint, not a hard limit. A value of 0 specifies no limit.

This value affects the size of individual output files, not the total output size. For smaller values, Vertica divides the output into more files; all data is still exported.

Default: 10GB


For writes to HDFS only, permission to apply to all exported files. You can specify the value in Unix octal format (such as 665) or user-group-other format—for example, rwxr-xr-x. The value must be formatted as a string even if using the octal format.

Valid octal values range between 0 and 1777, inclusive. See HDFS Permissions in the Apache Hadoop documentation.

When writing files to any destination other than HDFS, this parameter has no effect.

Default: 660, regardless of the value of fs.permissions.umask-mode in hdfs-site.xml.


For writes to HDFS only, permission to apply to all exported directories. Values follow the same rules as those for fileMode. Further, you must give the Vertica HDFS user full permission, at least rwx------ or 700.

When writing files to any destination other than HDFS, this parameter has no effect.

Default: 755, regardless of the value of fs.permissions.umask-mode in hdfs-site.xml.



Specifies how to partition table data using PARTITION BY. Within partitions you can sort by using ORDER BY. See SQL Analytics. This clause may contain column references but not expressions.

If you partition data, Vertica creates a Hive-style partition directory structure, transforming column names to lowercase. See Using Partition Columns for a description of the directory structure.

If you omit this clause, Vertica optimizes for maximum parallelism.


Specifies the data to export. See Query Restrictions for important limitations.



  • Source table: SELECT
  • Source table schema: USAGE
  • Destination directory: Write

Query Restrictions

The following requirements and restrictions apply:

  • You must provide an alias column label for selected column targets that are expressions.

  • The query can contain only a single outer SELECT statement. For example, you cannot use UNION:

    => EXPORT TO DELIMITED(directory = '/mnt/shared_nfs/accounts/rm') 
       OVER(PARTITION BY hash) 
       SELECT 1 as account_id, '{}' as json, 0 hash
       UNION ALL
       SELECT 2 as account_id, '{}' as json, 1 hash;
    ERROR 8975:  Only a single outer SELECT statement is supported
    HINT:  Please use a subquery for multiple outer SELECT statements

    Instead, rewrite the query to use a subquery:

    => EXPORT TO DELIMITED(directory = '/mnt/shared_nfs/accounts/rm')
       OVER(PARTITION BY hash)
         SELECT 1 as account_id, '{}' as json, 0 hash
         UNION ALL
         SELECT 2 as account_id, '{}' as json, 1 hash
       ) a; 
     Rows Exported 
    (1 row)			
  • To use composite statements such as UNION, INTERSECT, and EXCEPT, rewrite them as subqueries.

Data Types

This operation exports raw Flex columns as binary data.

You cannot export data from an external table that contains external, non-native data types, such as ROW. See Complex Types. This restriction applies even if your SELECT statement does not include those columns.


The export operation always creates an output directory, even if the query produces zero rows.

Output file names follow the pattern: [8-character-hash]-[nodename]-[thread-id].fileExtension.

Column names in partition directories are lowercase.

Files exported to a local file system by any Vertica user are owned by the Vertica superuser. Files exported to HDFS or object stores are owned by the Vertica user who exported the data.

The following requirements and restrictions apply:

  • Avoid concurrent exports to the same output destination. Doing so is an error on any file system and can produce incorrect results.
  • Use a shared file location for output. If you use a directory in the local file system, it must be an NFS-mounted directory.
  • For output to the local file system, you must have a USER storage location.
  • When exporting to the local file system, the permission mode is 700 for directories and 600 for files. You cannot override these values.

For restrictions specific to object stores (S3, GCS, or Azure), see Exporting to Object Stores.


The following example exports uncompressed comma-separated values (CSV) with a header row in each file:

=> EXPORT TO DELIMITED(directory='webhdfs:///user1/data', delimiter=',', addHeader='true') 
  AS SELECT * FROM public.sales;