Syntax
Parameters
Match columns by name
By default (BY POSITION), Firebolt maps source values to target columns in order: the first value goes to the first column, and so on. BY NAME instead matches each source column to the target column with the same name, so source order does not matter.
BY NAME reads column names from the source, so it requires a SELECT source (not VALUES) and every source column must be named. It cannot be combined with an explicit ( <column_name> [ , ... ] ) list, since the target columns are derived from the source names. A source column whose name matches no target column raises an error. Target columns the source does not produce are filled the same way as a positional insert: with the column default, or NULL when the column is nullable and has no default.
id, full_name, and gender by name regardless of their order in the SELECT, and leaves dob as NULL.
INSERT ON CONFLICT
This feature is in public preview.
ON CONFLICT clause provides a way to reconcile or merge new data with existing records by either skipping or overwriting rows that already exist. It is available for a narrow subset of INSERT statements. For more generic UPSERT or deduplication functionality, use the MERGE statement.
Given this clause, for each row proposed for insertion, either the insertion proceeds, or, if there already exists a row in the table matching the tuple specified by the CONFLICT columns, an alternative action will be taken. There are two possible alternatives - take no action, or update the pre-existing matched row(s) in some way.
DO NOTHINGenables anINSERT IGNOREworkload, whereby the newer row is simply discarded.DO UPDATEenables an UPSERT orINSERT UPDATEworkload, whereby the pre-existing matched row(s) can be partially or fully overwritten. The overwrite expressions can (but do not have to) reference the fresh data using theEXCLUDEDview name.DO UPDATE SET *can replace the exhaustiveSET colA = EXCLUDED.colA, colB = EXCLUDED.colB, ... , colN = EXCLUDED.colNif no data transformation is required.
Extra Parameters
INSERT ON CONFLICT Limitations:
INSERTexpression must be a singleVALUEStuple.- At least one
CONFLICTcolumn must be specified. These are not automatically deduced from primary index, etc. - Unless using
INSERT *, theINSERTcolumn list must be specified. Their names and ordering cannot get deduced fromVALUES.
Examples
First, create a table populated with student information as follows:INSERT to add two rows into the students table as follows:
dob column for date of birth does not have default value, so Firebolt sets it to NULL.
Settings to control behavior
insert_shardingto enforce partition locality during ingestion into partitioned tables.tablet_min_size_bytesandtablet_max_size_bytesto control min/max tablet sizes during ingestion.max_insert_threadsto control the maximum number of threads forINSERTstatements, limiting the degree of parallelism for tablet writing operations. This can reduce memory footprint during ingestion.