Flex tables
Flex tables are a different kind of database table designed for loading and querying unstructured data, also called semi-structured data. Flex tables allow you to load data with different or evolving schemas into a single table. You can then explore this data and materialize real columns from it.
If you know some of the columns in the data, you can define them. A flex table that also has real columns is called a hybrid table. Both flex and hybrid tables are fully supported tables, stored as projections and with the same K-safety as your database.
After you create a flex table, you can quickly load data without specifying its schema. This allows you to load arbitrary JSON data, log files, and other semi-structured data and immediately begin querying it.
Creating flex tables is similar to creating other tables, except column definitions are optional. When you create flex tables, with or without column definitions, Vertica implicitly adds a real column to your table, called __raw__
. This column stores loaded data. The __raw__
column is a LONG VARBINARY column with a NOT NULL constraint. It contains the documented limits for its data type (see Long data types). The __raw__
column's default maximum width is 130,000 bytes (with an absolute maximum of 32,000,000 bytes). You can change the default width with the FlexTableRawSize configuration parameter.
If you create a flex table without other column definitions, the table includes a second default column, __identity__
, declared as an auto-incrementing IDENTITY (1,1) column. When no other columns are defined, flex tables use the __identity__
column for segmentation and sort order.
Loading data into a flex table encodes the record into a VMap type and populates the __raw__
column. The VMap is a standard dictionary type, pairing keys with string values as virtual columns.
Flex table terms
Flex tables have the following special vocabulary:
-
VMap: An internal map data format.
-
Virtual Columns: Key-value pairs contained in a flex table
__raw__
column. -
Real Columns: Explicit columns defined in addition to the flex (VMap) column.
-
Promoted Columns: Virtual columns that have been materialized to real columns.
-
Map Keys: Virtual column names within VMap data.
In this section
- Getting started
- Understanding flex tables
- Creating flex tables
- Bulk loading data into flex tables
- Inserting data into flex tables
- Using flex tables for IDOL data
- Using flex table parsers
- Computing flex table keys
- Materializing flex tables
- Updating flex table views
- Querying flex tables
- Querying nested data
- Querying flex views
- Listing flex tables