Skip to main content
Store embeddings in a separate table. This is the default behavior, where a new table is created to store embeddings and a view joins the source table with the embeddings. This approach supports chunking, allowing multiple embeddings per source row.

Key features

  • New table created to store embeddings
  • View automatically joins source and embeddings tables
  • Supports chunking (multiple chunks per row)
  • Separate storage optimizes for different access patterns

Samples

Full configuration

Specify all destination details:
SELECT ai.create_vectorizer(
    'my_table'::regclass,
    destination => ai.destination_table(
        target_schema => 'public',
        target_table => 'my_table_embeddings_store',
        view_schema => 'public',
        view_name => 'my_table_embeddings'
    ),
    embedding => ai.embedding_openai('text-embedding-3-small', 768),
    chunking => ai.chunking_character_text_splitter(512)
);

Simpler configuration with defaults

Use a base name and let defaults apply:
SELECT ai.create_vectorizer(
    'my_table'::regclass,
    destination => ai.destination_table('my_table_embeddings'),
    embedding => ai.embedding_openai('text-embedding-3-small', 768),
    chunking => ai.chunking_character_text_splitter(512)
);
This creates:
  • Table: my_table_embeddings_store
  • View: my_table_embeddings

Arguments

NameTypeDefaultRequiredDescription
destinationNAME-Base name for view and table. View is named <destination>, table is named <destination>_store
target_schemaNAMESource table schemaSchema where the embeddings table will be created
target_tableNAME<source_table>_embedding_store or <destination>_storeName of the table where embeddings will be stored
view_schemaNAMESource table schemaSchema where the view will be created
view_nameNAME<source_table>_embedding or <destination>Name of the view that joins source and embeddings tables

Returns

A JSON configuration object for use in create_vectorizer().