INSERT keyword
Inserts data into a database table.
Syntax#
Parameters#
Two parameters may be provided to optimize INSERT AS SELECT queries when
inserting out-of-order records into an ordered dataset:
batchexpects abatchCount(integer) value how many records to process at any one timecommitLagexpects alagAmountwith a modifier to specify the unit of time for the value (i.e.20sfor 20 seconds). The following table describes the units that may be passed:unit description us microseconds s seconds m minutes h hours d days
Examples#
note
Columns can be omitted during INSERT in which case value will be NULL
Inserting query results#
This method allows you to insert as many rows as your query returns at once.
Inserting out-of-order data into an ordered dataset may be optimized using
batch and commitLag parameters:
info
Using the lag and batch size parameters during
INSERT AS SELECTstatements is a convenient strategy to load and order large datasets from CSV in bulk. This strategy along with an example workflow is described in the importing data guide.More details on ingesting out-of-order data with context on lag and uncommitted record count see the guide for configuring commit lag of out-of-order data
Hints and an example workflow using
INSERT AS SELECTfor bulk CSV import of out-of-order data can be found on the importing data via CSV documentation.