Import vector data
更新时间:
复制 MD 格式
AnalyticDB for PostgreSQL uses standard SQL for all vector write operations. Use INSERT for small batches during development or incremental ingestion, and COPY for bulk loading large datasets.
Insert rows
Use the INSERT statement to add individual rows or small batches to a vector table. Vector columns accept two equivalent formats:
-- ARRAY[] format
INSERT INTO chunks VALUES (default, 'xxx', '2023-05-04', 'aaa.bbb.ccc/xxx.pdf',
ARRAY[0.1, 0.2, 0.1, 0.3, ... 0.9]::real[]);
-- {} format
INSERT INTO chunks VALUES (default, 'xxx', '2023-05-04', 'aaa.bbb.ccc/xxx.pdf',
'{0.1, 0.2, 0.1, 0.3, ... 0.9}');Both formats produce identical results and can be used interchangeably.
Load data in bulk
For large datasets, use COPY instead of INSERT. COPY bypasses row-by-row processing and loads data significantly faster.
COPY chunks (id, content, created_at, source, embedding)
FROM '/path/to/data.csv'
WITH (FORMAT CSV, HEADER true);What's next
该文章对您有帮助吗?