SlideShare a Scribd company logo
1 of 80
Download to read offline
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Vectors are the new JSON
Jonathan Katz
(he/him/his)
Principal Product Manager ā€“ Technical
AWS
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved.
{
"id": 5432,
"name": "PostgreSQL",
"description": "World's most advanced open source
relational database",
"supportedVersions": [16, 15, 14, 13, 12]
}
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
{
"id": 5432,
"name":
"PostgreSQL",
"description":
"World's most advanced
open source relational
database",
"supportedVersions":
[16, 15, 14, 13, 12]
}
id 5432
name PostgreSQL
description world's most...
supportedVersions [16,15,14,13,12]
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
{
"id": 5432,
"name":
"PostgreSQL",
"description":
"World's most advanced
open source relational
database",
"supportedVersions":
[16, 15, 14, 13, 12]
}
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Timeline of JSON storage
ā€¢ 2000-2001: JSON invented
ā€¢ 2004: AJAX model emerges in wider deployments
ā€¢ 2006: RFC 4627 publishes JSON format
ā€¢ 2006-2009: JSON-specific data stores emerge
ā€¢ 2012: PostgreSQL adds support for JSON (text)
ā€¢ 2013: ECMA-404 standardizes JSON
ā€¢ 2014: PostgreSQL adds support for JSONB (binary)
ā€¢ 2017: SQL/JSON standard published
ā€¢ 2019: PostgreSQL adds SQL/JSON path language
ā€¢ 2023: PostgreSQL adds SQL/JSON constructors and predicates
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
[0.5, 0.5]
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Magnitude
|| [0.5, 0.5] || = āˆš (0.52 + 0.52) = 0.70710
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Direction
Magnitude
[0.5, 0.5]
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
[0.5, 0.5, 0.5]
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Pre-trained on vast amounts of
unstructured data
Contain large number of parameters that make
them capable of learning complex concepts
Can be applied in a wide range of contexts
Customize FMs using your data for domain
specific tasks
Generative AI is powered
by foundation models
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Retrieval Augmented
Generation (RAG)
Configure FM to interact with
your data
A N S W E R
Q U E S T I O N
K N O W L E D G E
B A S E S
F O U N D A T I O N
M O D E L
How much does a blue
elephant vase cost?
Product catalog
Price data
A blue elephant vase
typically costs $19.99
Sorry, I don't know
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The role of vectors in RAG
Document
chunks
Embeddings
PDF
document
Database
User
Embeddings Foundational
model
1
4
Question
Question + Context
Response
2 3
5
6
7
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Challenges with vectors
ā€¢ Time to generate embeddings
ā€¢ Embedding size
ā€¢ Compression
ā€¢ Query time
Blue elephant vase
that can hold up to
three plants in it,
hand paintedā€¦
0.1234
0.1231
0.1232
0.9005
0.2489
1536 dimensions
4-byte floats
6152B => 6KiB
0.12310
0.24234
0.59405
0.23430
0.23432
0.20551
0.70543
0.20559
0.20559
0.70543
0.23432
0.24234
0.23430
0.12310
0.20551
0.59405
1,000,000 => 5.7GB
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Approximate nearest neighbor (ANN)
ā€¢ Find similar vectors without
searching all of them
ā€¢ Faster than exact nearest
neighbor
ā€¢ ā€œRecallā€ ā€“ % of expected results
Recall: 80%
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Questions for choosing a vector storage system
ā€¢ Where does vector storage fit into my workflow?
ā€¢ How much data am I storing?
ā€¢ What matters to me: storage, performance, relevancy, cost?
ā€¢ What are my tradeoffs: indexing, query time, schema design?
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
PostgreSQL as a vector store
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why use PostgreSQL for vector searches?
ā€¢ Existing client libraries work without modification
ā€¢ Convenient to co-locate app + AI/ML data in same database
ā€¢ PostgreSQL acts as persistent transactional store while working with
other vector search systems
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Native vector support in PostgreSQL
ā€¢ ARRAY data type
Ā§ Multiple data types (int4, int8, float4,
float8)
Ā§ ā€œUnlimitedā€ dimensions
Ā§ No native distance operations
ā€“ Can add using Trusted Language
Extensions + PL/Rust
Ā§ No native indexing
ā€¢ Cube data type
Ā§ float8 values
Ā§ Euclidean, Manhattan, Chebyshev
distances
Ā§ K-NN GiST index ā€“ exact nearest
neighbor search
Ā§ Limited to 100 dimensions
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is pgvector?
An open source extension that:
adds support for storage, indexing, searching, metadata with choice of distance
vector data type
Supports IVFFlat/HNSW indexing
Distance operators (<->, <=>, <#>)
Exact nearest neighbor (K-NN)
Approximate nearest neighbor (ANN)
Co-locate with embeddings
github.com/pgvector/pgvector
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Understanding pgvector performance
0%
10%
20%
30%
40%
50%
60%
70%
0
5000
10000
15000
20000
25000
30000
35000
20 40 80 200 400 800
Speedup
(%)
Transactions/Second
(TPS)
hnsw.ef_search
1536-dimensional vector HNSW search
db.r6g.16xlarge db.r7g.16xlarge Speedup (%)
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
pgvector distance operations
<->
Euclidean/L2
<=>
Cosine distance
<#>
Inner product
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How does pgvector index a vector?
0.0234
0.093
-0.9123
0.1055
Valid?
āœ… Same dimensions?
āœ… Magnitude > 0?
Normalized?
šŸ›  If not, normalize
0.0253
0.1007
-0.9880
0.1142
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Indexing methods: IVFFlat and HNSW
ā€¢ IVFFlat
Ā§ K-means based
Ā§ Organize vectors into lists
Ā§ Requires prepopulated data
Ā§ Insert time bounded by # lists
ā€¢ HNSW
Ā§ Graph based
Ā§ Organize vectors into
ā€œneighborhoodsā€
Ā§ Iterative insertions
Ā§ Insertion time increases as data in
graph increases
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Which search method do I choose?
ā€¢ Exact nearest neighbors: No index
ā€¢ Fast indexing: IVFFlat*
ā€¢ Easy to manage: HNSW
ā€¢ High performance/recall: HNSW
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
pgvector strategies and best
practices
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Best practices for pgvector
Storage strategies
HNSW strategies
IVFFlat strategies
Filtering
Distributed queries
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
pgvector storage strategies
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Understanding TOAST in PostgreSQL
ā€¢ TOAST (The Oversized-Attribute Storage Technique) is a mechanism
for storing data larger than 8KB
ā€¢ By default, PostgreSQL ā€œTOASTsā€ values over 2KB
ā€¢ 510-dim 4-byte float vector
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
PostgreSQL column storage types
ā€¢ PLAIN: Data stored inline with table
ā€¢ EXTENDED: Data stored/compressed in TOAST table when threshold
exceeded
Ā§ pgvector default before 0.6.0
ā€¢ EXTERNAL: Data stored in TOAST table when threshold exceeded
Ā§ pgvector default 0.6.0+
ā€¢ MAIN: Data stored compressed inline with table
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Impact of TOAST on pgvector queries
Limit (cost=772135.51..772136.73 rows=10 width=12)
-> Gather Merge (cost=772135.51..1991670.17 rows=10000002 width=12)
Workers Planned: 6
-> Sort (cost=771135.42..775302.08 rows=1666667 width=12)
Sort Key: ((<-> embedding))
-> Parallel Seq Scan on vecs128 (cost=0.00..735119.34 rows=1666667
width=12)
128 dimensions
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Impact of TOAST on pgvector queries
Limit (cost=149970.15..149971.34 rows=10 width=12)
-> Gather Merge (cost=149970.15..1347330.44 rows=10000116 width=12)
Workers Planned: 4
-> Sort (cost=148970.09..155220.16 rows=2500029 width=12)
Sort Key: (($1 <-> embedding))
-> Parallel Seq Scan on vecs1536 (cost=0.00..94945.36 rows=2500029
width=12)
1,536 dimensions
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Strategies for pgvector and TOAST
ā€¢ Use PLAIN storage
Ā§ ALTER TABLE ā€¦ ALTER COLUMN ... SET STORAGE PLAIN
Ā§ Requires table rewrite (VACUUM FULL) if data already exists
Ā§ Limits vector sizes to 2,000 dimensions
ā€¢ Use min_parallel_table_scan_size to induce more parallel
workers
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Impact of TOAST on pgvector queries
Limit (cost=95704.33..95705.58 rows=10 width=12)
-> Gather Merge (cost=95704.33..1352239.13 rows=10000111 width=12)
Workers Planned: 11
-> Sort (cost=94704.11..96976.86 rows=909101 width=12)
Sort Key: (($1 <-> embedding))
-> Parallel Seq Scan on vecs1536 (cost=0.00..75058.77 rows=909101 width=12)
1,536 dimensions
SET min_parallel_table_scan_size TO 1
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
HNSW strategies
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
HNSW index building parameters
ā€¢ m
Ā§ Maximum number of bidirectional links between indexed vectors
Ā§ Default: 16
ā€¢ ef_construction
Ā§ Number of vectors to maintain in ā€œnearest neighborā€ list
Ā§ Default: 64
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building an HNSW index
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building an HNSW index
Layer 2
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building an HNSW index
Layer 2
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building an HNSW index
Layer 1
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building an HNSW index
Layer 0
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
HNSW query parameters
ā€¢ hnsw.ef_search
Ā§ Number of vectors to maintain in ā€œnearest neighborā€ list
Ā§ Must be greater than or equal to LIMIT
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Querying an HNSW index
Layer 2
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Querying an HNSW index
Layer 2
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Querying an HNSW index
Layer 1
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Querying an HNSW index
Layer 1
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Querying an HNSW index
Layer 0
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Querying an HNSW index
Layer 0
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Best practices for building HNSW indexes
ā€¢ Default values (M=16,ef_construction=64) usually work
ā€¢ (pgvector 0.5.1) Start with empty index and use concurrent writes to
accelerate builds
Ā§ INSERT or COPY
ā€¢ pgvector (0.6.0+) use parallel builds on a full table
Ā§ max_parallel_maintenance_workers
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Impact of parallelism on HNSW build time
0
100
200
300
400
500
600
700
800
900
1000
1 2 4 8 16 32 64
Time
(s)
Clients / Workers
HNSW index build (1,000,000 128-dim vectors)
Parallel Build Concurrent Inserts
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Choosing m and ef_construction (serial)
0.82
0.84
0.86
0.88
0.9
0.92
0.94
0
50
100
150
200
250
32 64 128 256 512
Recall
Index
build
(min)
ef_construction
1.1MM 1536-dim vectors, m=16, ef_search=20
Build Time (min) Recall
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Choosing m and ef_construction (parallel)
0.8
0.82
0.84
0.86
0.88
0.9
0.92
0.94
0
1
2
3
4
5
6
7
8
9
10
32 64 128 256 512
Recall
Index
build
(min)
ef_construction
1.1MM 1536-dim vectors, m=16, ef_search=20,
max_maintenance_workers=64
Build time Recall
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Choosing m and ef_construction
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
0
100
200
300
400
500
600
700
800
16 24 36 48
Recall
Index
build
(min)
m
1MM 960-dim vectors
Build Time (min) Recall
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Performance strategies for HNSW queries
ā€¢ Index building has biggest impact on performance/recall
Ā§ More time spent optimizing build increases likelihood of finding best candidates
in a neighborhood
ā€¢ Increasing hnsw.ef_search increases recall, decreases performance
ā€¢ Set shared_buffers to a value that keeps data (index) in memory
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
IVFFlat strategies
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
IVFFlat index building parameters
ā€¢ lists
Ā§ Number of ā€œbucketsā€ for organizing vectors
Ā§ Tradeoļ¬€ between number of vectors in bucket and relevancy
CREATE INDEX ON products
USING ivfflat(embedding) WITH (lists=3);
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building an IVFFlat index
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building an IVFFlat index: Assign lists
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Querying an IVFFlat index
SET ivfflat.probes TO 1
SELECT id FROM products ORDER BY $1 <-> embedding LIMIT 3
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Querying an IVFFlat index
SET ivfflat.probes TO 2
SELECT id FROM products ORDER BY $1 <-> embedding LIMIT 3
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Performance strategies for IVFFlat queries
ā€¢ Increasing ivfflat.probes increases recall, decreases performance
ā€¢ Lowering random_page_cost on a per-query basis can induce index
usage
ā€¢ Set shared_buffers to a value that keeps data (index) in memory
ā€¢ Increase work_mem on a per-query basis
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Best practices for building IVFFlat indexes
ā€¢ Choose value of lists to maximize recall but minimize effort of search
Ā§ < 1MM vectors: # vectors / 1000
Ā§ > 1MM vectors: āˆš(# vectors)
ā€¢ May be necessary to rebuild when adding/modifying vectors in index
ā€¢ Use parallelism to accelerate build times
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How parallelism works with pgvector IVFFlat
Vectors in
table
List
List
List
Assign to list
Sequential scan
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How parallelism works with pgvector IVFFlat
Vectors in
table
List
List
List
Assign to list
Parallel scan
Assign to list
Parallel scan
Assign to list
Parallel scan
Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Using parallelism to accelerate IVFFlat builds
0
20
40
60
80
100
120
140
Serial Parallel
Time
(s)
1MM 768-dim, lists=1000
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved.
pgvector filtering strategies
Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is filtering?
SELECT id
FROM products
WHERE products.category_id = 7
ORDER BY :'q' <-> products.embedding
LIMIT 10;
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved.
How filtering impacts ANN queries
ā€¢ PostgreSQL may choose to not use the index
ā€¢ Uses an index, but does not return enough results
ā€¢ Filtering occurs after using the index
Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Do I need an HNSW/IVFFlat index for a filter?
ā€¢ Does the filter use a B-Tree (or other index) to reduce the data set?
ā€¢ How many rows does the filter remove?
ā€¢ Do I want exact results or approximate results?
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved.
Filtering strategies
ā€¢ Partial index
ā€¢ Partition
CREATE INDEX ON docs
USING hnsw(embedding vector_l2_ops)
WHERE category_id = 7;
---
CREATE TABLE docs_cat7
PARTITION OF docs
FOR VALUES IN (7);
CREATE INDEX ON docs_cat7
USING hnsw(embedding vector_l2_ops);
Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Distributed pgvector queries
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved.
When does it make sense to distribute vector data?
ā€¢ Not enough memory for
workload to meet latency target
ā€¢ Network overhead must be
acceptable
ā€¢ Can manage complexity of multi-
node system
Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Setup foreign data wrapper
CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION IF NOT EXISTS postgres_fdw;
CREATE SERVER vectors1
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (
async_capable 'true', extensions 'vector', dbname 'vectors', host
'<NODE1>'
);
CREATE SERVER vectors2
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (
async_capable 'true', extensions 'vector', dbname 'vectors', host
'<NODE2>'
);
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Setup foreign tables
CREATE TABLE vectors (
id uuid,
node_id int,
embedding vector(768)
) PARTITION BY LIST(node_id);
CREATE FOREIGN TABLE vectors_node1 PARTITION OF vectors
FOR VALUES IN (1)
SERVER vectors1
OPTIONS (schema_name 'public', table_name 'vectors');
CREATE FOREIGN TABLE vectors_node2 PARTITION OF vectors
FOR VALUES IN (2)
SERVER vectors2
OPTIONS (schema_name 'public', table_name 'vectors');
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Example EXPLAIN output
Limit (cost=200.01..206.45 rows=10 width=28) (actual time=18.171..18.182 rows=10
loops=1)
-> Merge Append (cost=200.01..3222700.01 rows=5000000 width=28) (actual
time=18.169..18.179 rows=10 loops=1)
Sort Key: (('$1'::vector <=> vectors.embedding))
-> Foreign Scan on vectors_node1 vectors_1 (cost=100.00..1586350.00
rows=2500000 width=28) (actual time=8.607..8.609 rows=2 loops=1)
-> Foreign Scan on vectors_node2 vectors_2 (cost=100.00..1586350.00
rows=2500000 width=28) (actual time=9.559..9.566 rows=9 loops=1)
Planning Time: 0.298 ms
Execution Time: 19.355 ms
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Looking ahead
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
pgvector roadmap
ā€¢ Performance improvements for massively parallel HNSW builds
(completed)
ā€¢ Enhanced index-based filtering/HQANN (in progress)
ā€¢ More data types per dimension (float2, uint8) (in progress)
Ā§ Scalar quantization via expression indexes
ā€¢ Product quantization
ā€¢ Parallel query
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Conclusion
ā€¢ Like JSON, a vector is just a data type.
ā€¢ Primary design decision: query performance and recall
ā€¢ Determine where to invest: storage, compute, indexing strategy
ā€¢ Plan for today and tomorrow: pgvector is rapidly innovating
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you!
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Please complete the session
survey in the mobile app
Thank you!
Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Please complete the session
survey in the mobile app
Jonathan Katz
jkatz@amazon.com
@jkatz05

More Related Content

What's hot

Oracle SQL 1 Day Tutorial
Oracle SQL 1 Day TutorialOracle SQL 1 Day Tutorial
Oracle SQL 1 Day TutorialChien Chung Shen
Ā 
GoldenGate惆ć‚Æćƒ‹ć‚«ćƒ«ć‚»ćƒŸćƒŠćƒ¼2怌Oracle GoldenGate ę–°ę©Ÿčƒ½ęƒ…å ±ć€(2016/5/11)
GoldenGate惆ć‚Æćƒ‹ć‚«ćƒ«ć‚»ćƒŸćƒŠćƒ¼2怌Oracle GoldenGate ę–°ę©Ÿčƒ½ęƒ…å ±ć€(2016/5/11)GoldenGate惆ć‚Æćƒ‹ć‚«ćƒ«ć‚»ćƒŸćƒŠćƒ¼2怌Oracle GoldenGate ę–°ę©Ÿčƒ½ęƒ…å ±ć€(2016/5/11)
GoldenGate惆ć‚Æćƒ‹ć‚«ćƒ«ć‚»ćƒŸćƒŠćƒ¼2怌Oracle GoldenGate ę–°ę©Ÿčƒ½ęƒ…å ±ć€(2016/5/11)ć‚Ŗ惩ć‚Æ惫ć‚Øćƒ³ć‚øćƒ‹ć‚¢é€šäæ”
Ā 
Oracle Cloud Infrastructureļ¼š2021幓6꜈åŗ¦ć‚µćƒ¼ćƒ“ć‚¹ćƒ»ć‚¢ćƒƒćƒ—ćƒ‡ćƒ¼ćƒˆ
Oracle Cloud Infrastructureļ¼š2021幓6꜈åŗ¦ć‚µćƒ¼ćƒ“ć‚¹ćƒ»ć‚¢ćƒƒćƒ—ćƒ‡ćƒ¼ćƒˆOracle Cloud Infrastructureļ¼š2021幓6꜈åŗ¦ć‚µćƒ¼ćƒ“ć‚¹ćƒ»ć‚¢ćƒƒćƒ—ćƒ‡ćƒ¼ćƒˆ
Oracle Cloud Infrastructureļ¼š2021幓6꜈åŗ¦ć‚µćƒ¼ćƒ“ć‚¹ćƒ»ć‚¢ćƒƒćƒ—ćƒ‡ćƒ¼ćƒˆć‚Ŗ惩ć‚Æ惫ć‚Øćƒ³ć‚øćƒ‹ć‚¢é€šäæ”
Ā 
怐ꗧē‰ˆć€‘Oracle Exadata Cloud Serviceļ¼šć‚µćƒ¼ćƒ“ć‚¹ę¦‚č¦ć®ć”ē“¹ä»‹ [2021幓7꜈ē‰ˆ]
怐ꗧē‰ˆć€‘Oracle Exadata Cloud Serviceļ¼šć‚µćƒ¼ćƒ“ć‚¹ę¦‚č¦ć®ć”ē“¹ä»‹ [2021幓7꜈ē‰ˆ]怐ꗧē‰ˆć€‘Oracle Exadata Cloud Serviceļ¼šć‚µćƒ¼ćƒ“ć‚¹ę¦‚č¦ć®ć”ē“¹ä»‹ [2021幓7꜈ē‰ˆ]
怐ꗧē‰ˆć€‘Oracle Exadata Cloud Serviceļ¼šć‚µćƒ¼ćƒ“ć‚¹ę¦‚č¦ć®ć”ē“¹ä»‹ [2021幓7꜈ē‰ˆ]ć‚Ŗ惩ć‚Æ惫ć‚Øćƒ³ć‚øćƒ‹ć‚¢é€šäæ”
Ā 
ć‚Ŗćƒ³ćƒ—ćƒ¬ćƒŸć‚¹ć‹ć‚‰ć‚Æćƒ©ć‚¦ćƒ‰ćøļ¼šOracle Database恮ē§»č”Œćƒ™ć‚¹ćƒˆćƒ—ćƒ©ć‚Æćƒ†ć‚£ć‚¹ć‚’č§£čŖ¬ (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓2꜈18ę—„)
ć‚Ŗćƒ³ćƒ—ćƒ¬ćƒŸć‚¹ć‹ć‚‰ć‚Æćƒ©ć‚¦ćƒ‰ćøļ¼šOracle Database恮ē§»č”Œćƒ™ć‚¹ćƒˆćƒ—ćƒ©ć‚Æćƒ†ć‚£ć‚¹ć‚’č§£čŖ¬ (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓2꜈18ę—„)ć‚Ŗćƒ³ćƒ—ćƒ¬ćƒŸć‚¹ć‹ć‚‰ć‚Æćƒ©ć‚¦ćƒ‰ćøļ¼šOracle Database恮ē§»č”Œćƒ™ć‚¹ćƒˆćƒ—ćƒ©ć‚Æćƒ†ć‚£ć‚¹ć‚’č§£čŖ¬ (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓2꜈18ę—„)
ć‚Ŗćƒ³ćƒ—ćƒ¬ćƒŸć‚¹ć‹ć‚‰ć‚Æćƒ©ć‚¦ćƒ‰ćøļ¼šOracle Database恮ē§»č”Œćƒ™ć‚¹ćƒˆćƒ—ćƒ©ć‚Æćƒ†ć‚£ć‚¹ć‚’č§£čŖ¬ (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓2꜈18ę—„)ć‚Ŗ惩ć‚Æ惫ć‚Øćƒ³ć‚øćƒ‹ć‚¢é€šäæ”
Ā 
äŗ‹ä¾‹ć‹ć‚‰č¦‹ć‚‹č¦ęؔ刄ć‚Æćƒ©ć‚¦ćƒ‰ćƒ»ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć®éøć³ę–¹ (Oracle Database) (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓6꜈30ę—„)
äŗ‹ä¾‹ć‹ć‚‰č¦‹ć‚‹č¦ęؔ刄ć‚Æćƒ©ć‚¦ćƒ‰ćƒ»ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć®éøć³ę–¹ (Oracle Database) (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓6꜈30ę—„)äŗ‹ä¾‹ć‹ć‚‰č¦‹ć‚‹č¦ęؔ刄ć‚Æćƒ©ć‚¦ćƒ‰ćƒ»ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć®éøć³ę–¹ (Oracle Database) (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓6꜈30ę—„)
äŗ‹ä¾‹ć‹ć‚‰č¦‹ć‚‹č¦ęؔ刄ć‚Æćƒ©ć‚¦ćƒ‰ćƒ»ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć®éøć³ę–¹ (Oracle Database) (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓6꜈30ę—„)ć‚Ŗ惩ć‚Æ惫ć‚Øćƒ³ć‚øćƒ‹ć‚¢é€šäæ”
Ā 
Oracle GoldenGate 19c 悒ä½æē”Ø恗恟 ē°”å˜ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ē§»č”Œć‚¬ć‚¤ćƒ‰_v1.0
Oracle GoldenGate 19c 悒ä½æē”Ø恗恟 ē°”å˜ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ē§»č”Œć‚¬ć‚¤ćƒ‰_v1.0Oracle GoldenGate 19c 悒ä½æē”Ø恗恟 ē°”å˜ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ē§»č”Œć‚¬ć‚¤ćƒ‰_v1.0
Oracle GoldenGate 19c 悒ä½æē”Ø恗恟 ē°”å˜ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ē§»č”Œć‚¬ć‚¤ćƒ‰_v1.0ć‚Ŗ惩ć‚Æ惫ć‚Øćƒ³ć‚øćƒ‹ć‚¢é€šäæ”
Ā 
Oracle data integrator 12c - getting started
Oracle data integrator 12c - getting startedOracle data integrator 12c - getting started
Oracle data integrator 12c - getting startedMichael Rainey
Ā 
Automate the operation of your Oracle Cloud infrastructure v2.0
Automate the operation of your Oracle Cloud infrastructure v2.0Automate the operation of your Oracle Cloud infrastructure v2.0
Automate the operation of your Oracle Cloud infrastructure v2.0Nelson Calero
Ā 
Oracle Tablespace介ē“¹
Oracle Tablespace介ē“¹Oracle Tablespace介ē“¹
Oracle Tablespace介ē“¹Chien Chung Shen
Ā 
Rac rac one_nodečŖ¬ę˜Žč³‡ę–™
Rac rac one_nodečŖ¬ę˜Žč³‡ę–™Rac rac one_nodečŖ¬ę˜Žč³‡ę–™
Rac rac one_nodečŖ¬ę˜Žč³‡ę–™Hiroki Morita
Ā 
Data Virtualization: An Introduction
Data Virtualization: An IntroductionData Virtualization: An Introduction
Data Virtualization: An IntroductionDenodo
Ā 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1Chien Chung Shen
Ā 
Oracle Database / Exadata Cloud ęŠ€č”“ęƒ…å ±(Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2020幓7꜈9ę—„)
Oracle Database / Exadata Cloud ęŠ€č”“ęƒ…å ±(Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2020幓7꜈9ę—„)Oracle Database / Exadata Cloud ęŠ€č”“ęƒ…å ±(Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2020幓7꜈9ę—„)
Oracle Database / Exadata Cloud ęŠ€č”“ęƒ…å ±(Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2020幓7꜈9ę—„)ć‚Ŗ惩ć‚Æ惫ć‚Øćƒ³ć‚øćƒ‹ć‚¢é€šäæ”
Ā 

What's hot (20)

Oracle Data Integrator Cloud Servicećƒ¦ćƒ¼ć‚¶ćƒ¼ć‚ŗć‚¬ć‚¤ćƒ‰
Oracle Data Integrator Cloud Servicećƒ¦ćƒ¼ć‚¶ćƒ¼ć‚ŗć‚¬ć‚¤ćƒ‰Oracle Data Integrator Cloud Servicećƒ¦ćƒ¼ć‚¶ćƒ¼ć‚ŗć‚¬ć‚¤ćƒ‰
Oracle Data Integrator Cloud Servicećƒ¦ćƒ¼ć‚¶ćƒ¼ć‚ŗć‚¬ć‚¤ćƒ‰
Ā 
Oracle SQL 1 Day Tutorial
Oracle SQL 1 Day TutorialOracle SQL 1 Day Tutorial
Oracle SQL 1 Day Tutorial
Ā 
GoldenGate惆ć‚Æćƒ‹ć‚«ćƒ«ć‚»ćƒŸćƒŠćƒ¼2怌Oracle GoldenGate ę–°ę©Ÿčƒ½ęƒ…å ±ć€(2016/5/11)
GoldenGate惆ć‚Æćƒ‹ć‚«ćƒ«ć‚»ćƒŸćƒŠćƒ¼2怌Oracle GoldenGate ę–°ę©Ÿčƒ½ęƒ…å ±ć€(2016/5/11)GoldenGate惆ć‚Æćƒ‹ć‚«ćƒ«ć‚»ćƒŸćƒŠćƒ¼2怌Oracle GoldenGate ę–°ę©Ÿčƒ½ęƒ…å ±ć€(2016/5/11)
GoldenGate惆ć‚Æćƒ‹ć‚«ćƒ«ć‚»ćƒŸćƒŠćƒ¼2怌Oracle GoldenGate ę–°ę©Ÿčƒ½ęƒ…å ±ć€(2016/5/11)
Ā 
Oracle GoldenGate
Oracle GoldenGate Oracle GoldenGate
Oracle GoldenGate
Ā 
Oracle Cloud Infrastructureļ¼š2021幓6꜈åŗ¦ć‚µćƒ¼ćƒ“ć‚¹ćƒ»ć‚¢ćƒƒćƒ—ćƒ‡ćƒ¼ćƒˆ
Oracle Cloud Infrastructureļ¼š2021幓6꜈åŗ¦ć‚µćƒ¼ćƒ“ć‚¹ćƒ»ć‚¢ćƒƒćƒ—ćƒ‡ćƒ¼ćƒˆOracle Cloud Infrastructureļ¼š2021幓6꜈åŗ¦ć‚µćƒ¼ćƒ“ć‚¹ćƒ»ć‚¢ćƒƒćƒ—ćƒ‡ćƒ¼ćƒˆ
Oracle Cloud Infrastructureļ¼š2021幓6꜈åŗ¦ć‚µćƒ¼ćƒ“ć‚¹ćƒ»ć‚¢ćƒƒćƒ—ćƒ‡ćƒ¼ćƒˆ
Ā 
怐ꗧē‰ˆć€‘Oracle Exadata Cloud Serviceļ¼šć‚µćƒ¼ćƒ“ć‚¹ę¦‚č¦ć®ć”ē“¹ä»‹ [2021幓7꜈ē‰ˆ]
怐ꗧē‰ˆć€‘Oracle Exadata Cloud Serviceļ¼šć‚µćƒ¼ćƒ“ć‚¹ę¦‚č¦ć®ć”ē“¹ä»‹ [2021幓7꜈ē‰ˆ]怐ꗧē‰ˆć€‘Oracle Exadata Cloud Serviceļ¼šć‚µćƒ¼ćƒ“ć‚¹ę¦‚č¦ć®ć”ē“¹ä»‹ [2021幓7꜈ē‰ˆ]
怐ꗧē‰ˆć€‘Oracle Exadata Cloud Serviceļ¼šć‚µćƒ¼ćƒ“ć‚¹ę¦‚č¦ć®ć”ē“¹ä»‹ [2021幓7꜈ē‰ˆ]
Ā 
ć‚Ŗćƒ³ćƒ—ćƒ¬ćƒŸć‚¹ć‹ć‚‰ć‚Æćƒ©ć‚¦ćƒ‰ćøļ¼šOracle Database恮ē§»č”Œćƒ™ć‚¹ćƒˆćƒ—ćƒ©ć‚Æćƒ†ć‚£ć‚¹ć‚’č§£čŖ¬ (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓2꜈18ę—„)
ć‚Ŗćƒ³ćƒ—ćƒ¬ćƒŸć‚¹ć‹ć‚‰ć‚Æćƒ©ć‚¦ćƒ‰ćøļ¼šOracle Database恮ē§»č”Œćƒ™ć‚¹ćƒˆćƒ—ćƒ©ć‚Æćƒ†ć‚£ć‚¹ć‚’č§£čŖ¬ (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓2꜈18ę—„)ć‚Ŗćƒ³ćƒ—ćƒ¬ćƒŸć‚¹ć‹ć‚‰ć‚Æćƒ©ć‚¦ćƒ‰ćøļ¼šOracle Database恮ē§»č”Œćƒ™ć‚¹ćƒˆćƒ—ćƒ©ć‚Æćƒ†ć‚£ć‚¹ć‚’č§£čŖ¬ (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓2꜈18ę—„)
ć‚Ŗćƒ³ćƒ—ćƒ¬ćƒŸć‚¹ć‹ć‚‰ć‚Æćƒ©ć‚¦ćƒ‰ćøļ¼šOracle Database恮ē§»č”Œćƒ™ć‚¹ćƒˆćƒ—ćƒ©ć‚Æćƒ†ć‚£ć‚¹ć‚’č§£čŖ¬ (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓2꜈18ę—„)
Ā 
Bigquery 101
Bigquery 101Bigquery 101
Bigquery 101
Ā 
Operational Data Vault
Operational Data VaultOperational Data Vault
Operational Data Vault
Ā 
äŗ‹ä¾‹ć‹ć‚‰č¦‹ć‚‹č¦ęؔ刄ć‚Æćƒ©ć‚¦ćƒ‰ćƒ»ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć®éøć³ę–¹ (Oracle Database) (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓6꜈30ę—„)
äŗ‹ä¾‹ć‹ć‚‰č¦‹ć‚‹č¦ęؔ刄ć‚Æćƒ©ć‚¦ćƒ‰ćƒ»ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć®éøć³ę–¹ (Oracle Database) (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓6꜈30ę—„)äŗ‹ä¾‹ć‹ć‚‰č¦‹ć‚‹č¦ęؔ刄ć‚Æćƒ©ć‚¦ćƒ‰ćƒ»ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć®éøć³ę–¹ (Oracle Database) (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓6꜈30ę—„)
äŗ‹ä¾‹ć‹ć‚‰č¦‹ć‚‹č¦ęؔ刄ć‚Æćƒ©ć‚¦ćƒ‰ćƒ»ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ć®éøć³ę–¹ (Oracle Database) (Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2021幓6꜈30ę—„)
Ā 
Oracle Integration Cloud ꦂ要ļ¼ˆ20200507ē‰ˆļ¼‰
Oracle Integration Cloud ꦂ要ļ¼ˆ20200507ē‰ˆļ¼‰Oracle Integration Cloud ꦂ要ļ¼ˆ20200507ē‰ˆļ¼‰
Oracle Integration Cloud ꦂ要ļ¼ˆ20200507ē‰ˆļ¼‰
Ā 
Oracle GoldenGate 19c 悒ä½æē”Ø恗恟 ē°”å˜ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ē§»č”Œć‚¬ć‚¤ćƒ‰_v1.0
Oracle GoldenGate 19c 悒ä½æē”Ø恗恟 ē°”å˜ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ē§»č”Œć‚¬ć‚¤ćƒ‰_v1.0Oracle GoldenGate 19c 悒ä½æē”Ø恗恟 ē°”å˜ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ē§»č”Œć‚¬ć‚¤ćƒ‰_v1.0
Oracle GoldenGate 19c 悒ä½æē”Ø恗恟 ē°”å˜ćƒ‡ćƒ¼ć‚æćƒ™ćƒ¼ć‚¹ē§»č”Œć‚¬ć‚¤ćƒ‰_v1.0
Ā 
Oracle data integrator 12c - getting started
Oracle data integrator 12c - getting startedOracle data integrator 12c - getting started
Oracle data integrator 12c - getting started
Ā 
Automate the operation of your Oracle Cloud infrastructure v2.0
Automate the operation of your Oracle Cloud infrastructure v2.0Automate the operation of your Oracle Cloud infrastructure v2.0
Automate the operation of your Oracle Cloud infrastructure v2.0
Ā 
Oracle Tablespace介ē“¹
Oracle Tablespace介ē“¹Oracle Tablespace介ē“¹
Oracle Tablespace介ē“¹
Ā 
Rac rac one_nodečŖ¬ę˜Žč³‡ę–™
Rac rac one_nodečŖ¬ę˜Žč³‡ę–™Rac rac one_nodečŖ¬ę˜Žč³‡ę–™
Rac rac one_nodečŖ¬ę˜Žč³‡ę–™
Ā 
Data Virtualization: An Introduction
Data Virtualization: An IntroductionData Virtualization: An Introduction
Data Virtualization: An Introduction
Ā 
Oracle GoldenGate FAQ
Oracle GoldenGate FAQOracle GoldenGate FAQ
Oracle GoldenGate FAQ
Ā 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1
Ā 
Oracle Database / Exadata Cloud ęŠ€č”“ęƒ…å ±(Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2020幓7꜈9ę—„)
Oracle Database / Exadata Cloud ęŠ€č”“ęƒ…å ±(Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2020幓7꜈9ę—„)Oracle Database / Exadata Cloud ęŠ€č”“ęƒ…å ±(Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2020幓7꜈9ę—„)
Oracle Database / Exadata Cloud ęŠ€č”“ęƒ…å ±(Oracle Cloudć‚¦ć‚§ćƒ“ćƒŠćƒ¼ć‚·ćƒŖćƒ¼ć‚ŗ: 2020幓7꜈9ę—„)
Ā 

Similar to Vectors are the new JSON in PostgreSQL (SCaLE 21x)

AWS reInvent 2022 reCap AI/ML and Data
AWS reInvent 2022 reCap AI/ML and DataAWS reInvent 2022 reCap AI/ML and Data
AWS reInvent 2022 reCap AI/ML and DataChris Fregly
Ā 
AWS Lambda Powertools walkthrough.pdf
AWS Lambda Powertools walkthrough.pdfAWS Lambda Powertools walkthrough.pdf
AWS Lambda Powertools walkthrough.pdfHeitor Lessa
Ā 
Single View of Data
Single View of DataSingle View of Data
Single View of Dataconfluent
Ā 
Build Developer Experience Teams for Open Source
Build Developer Experience Teams for Open SourceBuild Developer Experience Teams for Open Source
Build Developer Experience Teams for Open SourceAll Things Open
Ā 
Re:cap dĆ­a 1 del Aws Re:Invent 2023 - AWS UG Chile
Re:cap dĆ­a 1 del Aws Re:Invent 2023 - AWS UG ChileRe:cap dĆ­a 1 del Aws Re:Invent 2023 - AWS UG Chile
Re:cap dĆ­a 1 del Aws Re:Invent 2023 - AWS UG ChileAlvaro Garcia
Ā 
Revolutionizing API Development: Collaborative Workflows with Postman
Revolutionizing API Development: Collaborative Workflows with PostmanRevolutionizing API Development: Collaborative Workflows with Postman
Revolutionizing API Development: Collaborative Workflows with PostmanPostman
Ā 
Get More from your Data: Accelerate Time-to-Value and Reduce TCO with Conflue...
Get More from your Data: Accelerate Time-to-Value and Reduce TCO with Conflue...Get More from your Data: Accelerate Time-to-Value and Reduce TCO with Conflue...
Get More from your Data: Accelerate Time-to-Value and Reduce TCO with Conflue...HostedbyConfluent
Ā 
AWS re-Invent re-Cap general deck 2022-2023 .pdf
AWS re-Invent re-Cap general deck 2022-2023 .pdfAWS re-Invent re-Cap general deck 2022-2023 .pdf
AWS re-Invent re-Cap general deck 2022-2023 .pdfRohini Gaonkar
Ā 
PDF_Slide__Memodernisasi_aplikasi_Microsoft_Anda_dengan_cepat_di_AWS.pdf
PDF_Slide__Memodernisasi_aplikasi_Microsoft_Anda_dengan_cepat_di_AWS.pdfPDF_Slide__Memodernisasi_aplikasi_Microsoft_Anda_dengan_cepat_di_AWS.pdf
PDF_Slide__Memodernisasi_aplikasi_Microsoft_Anda_dengan_cepat_di_AWS.pdfRopiudin5
Ā 
Vectors are the new JSON in PostgreSQL
Vectors are the new JSON in PostgreSQLVectors are the new JSON in PostgreSQL
Vectors are the new JSON in PostgreSQLJonathan Katz
Ā 
Module 1 - CP Datalake on AWS
Module 1 - CP Datalake on AWSModule 1 - CP Datalake on AWS
Module 1 - CP Datalake on AWSLam Le
Ā 
AWS ReInvent 2023 Recap: AWS User GroupKolkata
AWS ReInvent 2023 Recap: AWS User GroupKolkataAWS ReInvent 2023 Recap: AWS User GroupKolkata
AWS ReInvent 2023 Recap: AWS User GroupKolkataAritra Nag
Ā 
AWS reInvent 2023 re:Cap services Slide deck
AWS reInvent 2023 re:Cap services Slide deckAWS reInvent 2023 re:Cap services Slide deck
AWS reInvent 2023 re:Cap services Slide deckSammy Cheung
Ā 
AWS_for_Data_Spaces_Oussama_Kandakji.pdf
AWS_for_Data_Spaces_Oussama_Kandakji.pdfAWS_for_Data_Spaces_Oussama_Kandakji.pdf
AWS_for_Data_Spaces_Oussama_Kandakji.pdfFIWARE
Ā 
Keynote Gregor Hohpe - Serverless Architectures
Keynote Gregor Hohpe - Serverless ArchitecturesKeynote Gregor Hohpe - Serverless Architectures
Keynote Gregor Hohpe - Serverless ArchitecturesBATbern
Ā 
Better Together: Delivering Graph Value with AWS & Neo4j - Antony Prasad Thev...
Better Together: Delivering Graph Value with AWS & Neo4j - Antony Prasad Thev...Better Together: Delivering Graph Value with AWS & Neo4j - Antony Prasad Thev...
Better Together: Delivering Graph Value with AWS & Neo4j - Antony Prasad Thev...Neo4j
Ā 
ę·±å…„ę·ŗå‡ŗ Amazon Database Migration Service
ę·±å…„ę·ŗå‡ŗ Amazon Database Migration Service ę·±å…„ę·ŗå‡ŗ Amazon Database Migration Service
ę·±å…„ę·ŗå‡ŗ Amazon Database Migration Service Amazon Web Services
Ā 
Analyze Amazon CloudFront and Lambda@Edge Logs to Improve Customer Experience...
Analyze Amazon CloudFront and Lambda@Edge Logs to Improve Customer Experience...Analyze Amazon CloudFront and Lambda@Edge Logs to Improve Customer Experience...
Analyze Amazon CloudFront and Lambda@Edge Logs to Improve Customer Experience...Amazon Web Services
Ā 
Getting Started with Amazon Database Migration Service
Getting Started with Amazon Database Migration ServiceGetting Started with Amazon Database Migration Service
Getting Started with Amazon Database Migration ServiceAmazon Web Services
Ā 
Cloud Based Business Intelligence with Amazon QuickSight - AWS Online Tech Talks
Cloud Based Business Intelligence with Amazon QuickSight - AWS Online Tech TalksCloud Based Business Intelligence with Amazon QuickSight - AWS Online Tech Talks
Cloud Based Business Intelligence with Amazon QuickSight - AWS Online Tech TalksAmazon Web Services
Ā 

Similar to Vectors are the new JSON in PostgreSQL (SCaLE 21x) (20)

AWS reInvent 2022 reCap AI/ML and Data
AWS reInvent 2022 reCap AI/ML and DataAWS reInvent 2022 reCap AI/ML and Data
AWS reInvent 2022 reCap AI/ML and Data
Ā 
AWS Lambda Powertools walkthrough.pdf
AWS Lambda Powertools walkthrough.pdfAWS Lambda Powertools walkthrough.pdf
AWS Lambda Powertools walkthrough.pdf
Ā 
Single View of Data
Single View of DataSingle View of Data
Single View of Data
Ā 
Build Developer Experience Teams for Open Source
Build Developer Experience Teams for Open SourceBuild Developer Experience Teams for Open Source
Build Developer Experience Teams for Open Source
Ā 
Re:cap dĆ­a 1 del Aws Re:Invent 2023 - AWS UG Chile
Re:cap dĆ­a 1 del Aws Re:Invent 2023 - AWS UG ChileRe:cap dĆ­a 1 del Aws Re:Invent 2023 - AWS UG Chile
Re:cap dĆ­a 1 del Aws Re:Invent 2023 - AWS UG Chile
Ā 
Revolutionizing API Development: Collaborative Workflows with Postman
Revolutionizing API Development: Collaborative Workflows with PostmanRevolutionizing API Development: Collaborative Workflows with Postman
Revolutionizing API Development: Collaborative Workflows with Postman
Ā 
Get More from your Data: Accelerate Time-to-Value and Reduce TCO with Conflue...
Get More from your Data: Accelerate Time-to-Value and Reduce TCO with Conflue...Get More from your Data: Accelerate Time-to-Value and Reduce TCO with Conflue...
Get More from your Data: Accelerate Time-to-Value and Reduce TCO with Conflue...
Ā 
AWS re-Invent re-Cap general deck 2022-2023 .pdf
AWS re-Invent re-Cap general deck 2022-2023 .pdfAWS re-Invent re-Cap general deck 2022-2023 .pdf
AWS re-Invent re-Cap general deck 2022-2023 .pdf
Ā 
PDF_Slide__Memodernisasi_aplikasi_Microsoft_Anda_dengan_cepat_di_AWS.pdf
PDF_Slide__Memodernisasi_aplikasi_Microsoft_Anda_dengan_cepat_di_AWS.pdfPDF_Slide__Memodernisasi_aplikasi_Microsoft_Anda_dengan_cepat_di_AWS.pdf
PDF_Slide__Memodernisasi_aplikasi_Microsoft_Anda_dengan_cepat_di_AWS.pdf
Ā 
Vectors are the new JSON in PostgreSQL
Vectors are the new JSON in PostgreSQLVectors are the new JSON in PostgreSQL
Vectors are the new JSON in PostgreSQL
Ā 
Module 1 - CP Datalake on AWS
Module 1 - CP Datalake on AWSModule 1 - CP Datalake on AWS
Module 1 - CP Datalake on AWS
Ā 
AWS ReInvent 2023 Recap: AWS User GroupKolkata
AWS ReInvent 2023 Recap: AWS User GroupKolkataAWS ReInvent 2023 Recap: AWS User GroupKolkata
AWS ReInvent 2023 Recap: AWS User GroupKolkata
Ā 
AWS reInvent 2023 re:Cap services Slide deck
AWS reInvent 2023 re:Cap services Slide deckAWS reInvent 2023 re:Cap services Slide deck
AWS reInvent 2023 re:Cap services Slide deck
Ā 
AWS_for_Data_Spaces_Oussama_Kandakji.pdf
AWS_for_Data_Spaces_Oussama_Kandakji.pdfAWS_for_Data_Spaces_Oussama_Kandakji.pdf
AWS_for_Data_Spaces_Oussama_Kandakji.pdf
Ā 
Keynote Gregor Hohpe - Serverless Architectures
Keynote Gregor Hohpe - Serverless ArchitecturesKeynote Gregor Hohpe - Serverless Architectures
Keynote Gregor Hohpe - Serverless Architectures
Ā 
Better Together: Delivering Graph Value with AWS & Neo4j - Antony Prasad Thev...
Better Together: Delivering Graph Value with AWS & Neo4j - Antony Prasad Thev...Better Together: Delivering Graph Value with AWS & Neo4j - Antony Prasad Thev...
Better Together: Delivering Graph Value with AWS & Neo4j - Antony Prasad Thev...
Ā 
ę·±å…„ę·ŗå‡ŗ Amazon Database Migration Service
ę·±å…„ę·ŗå‡ŗ Amazon Database Migration Service ę·±å…„ę·ŗå‡ŗ Amazon Database Migration Service
ę·±å…„ę·ŗå‡ŗ Amazon Database Migration Service
Ā 
Analyze Amazon CloudFront and Lambda@Edge Logs to Improve Customer Experience...
Analyze Amazon CloudFront and Lambda@Edge Logs to Improve Customer Experience...Analyze Amazon CloudFront and Lambda@Edge Logs to Improve Customer Experience...
Analyze Amazon CloudFront and Lambda@Edge Logs to Improve Customer Experience...
Ā 
Getting Started with Amazon Database Migration Service
Getting Started with Amazon Database Migration ServiceGetting Started with Amazon Database Migration Service
Getting Started with Amazon Database Migration Service
Ā 
Cloud Based Business Intelligence with Amazon QuickSight - AWS Online Tech Talks
Cloud Based Business Intelligence with Amazon QuickSight - AWS Online Tech TalksCloud Based Business Intelligence with Amazon QuickSight - AWS Online Tech Talks
Cloud Based Business Intelligence with Amazon QuickSight - AWS Online Tech Talks
Ā 

More from Jonathan Katz

Looking ahead at PostgreSQL 15
Looking ahead at PostgreSQL 15Looking ahead at PostgreSQL 15
Looking ahead at PostgreSQL 15Jonathan Katz
Ā 
Build a Complex, Realtime Data Management App with Postgres 14!
Build a Complex, Realtime Data Management App with Postgres 14!Build a Complex, Realtime Data Management App with Postgres 14!
Build a Complex, Realtime Data Management App with Postgres 14!Jonathan Katz
Ā 
High Availability PostgreSQL on OpenShift...and more!
High Availability PostgreSQL on OpenShift...and more!High Availability PostgreSQL on OpenShift...and more!
High Availability PostgreSQL on OpenShift...and more!Jonathan Katz
Ā 
Get Your Insecure PostgreSQL Passwords to SCRAM
Get Your Insecure PostgreSQL Passwords to SCRAMGet Your Insecure PostgreSQL Passwords to SCRAM
Get Your Insecure PostgreSQL Passwords to SCRAMJonathan Katz
Ā 
Safely Protect PostgreSQL Passwords - Tell Others to SCRAM
Safely Protect PostgreSQL Passwords - Tell Others to SCRAMSafely Protect PostgreSQL Passwords - Tell Others to SCRAM
Safely Protect PostgreSQL Passwords - Tell Others to SCRAMJonathan Katz
Ā 
Operating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesOperating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesJonathan Katz
Ā 
Building a Complex, Real-Time Data Management Application
Building a Complex, Real-Time Data Management ApplicationBuilding a Complex, Real-Time Data Management Application
Building a Complex, Real-Time Data Management ApplicationJonathan Katz
Ā 
Using PostgreSQL With Docker & Kubernetes - July 2018
Using PostgreSQL With Docker & Kubernetes - July 2018Using PostgreSQL With Docker & Kubernetes - July 2018
Using PostgreSQL With Docker & Kubernetes - July 2018Jonathan Katz
Ā 
An Introduction to Using PostgreSQL with Docker & Kubernetes
An Introduction to Using PostgreSQL with Docker & KubernetesAn Introduction to Using PostgreSQL with Docker & Kubernetes
An Introduction to Using PostgreSQL with Docker & KubernetesJonathan Katz
Ā 
Developing and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDWDeveloping and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDWJonathan Katz
Ā 
On Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data TypesOn Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data TypesJonathan Katz
Ā 
Accelerating Local Search with PostgreSQL (KNN-Search)
Accelerating Local Search with PostgreSQL (KNN-Search)Accelerating Local Search with PostgreSQL (KNN-Search)
Accelerating Local Search with PostgreSQL (KNN-Search)Jonathan Katz
Ā 
Webscale PostgreSQL - JSONB and Horizontal Scaling Strategies
Webscale PostgreSQL - JSONB and Horizontal Scaling StrategiesWebscale PostgreSQL - JSONB and Horizontal Scaling Strategies
Webscale PostgreSQL - JSONB and Horizontal Scaling StrategiesJonathan Katz
Ā 
Indexing Complex PostgreSQL Data Types
Indexing Complex PostgreSQL Data TypesIndexing Complex PostgreSQL Data Types
Indexing Complex PostgreSQL Data TypesJonathan Katz
Ā 

More from Jonathan Katz (14)

Looking ahead at PostgreSQL 15
Looking ahead at PostgreSQL 15Looking ahead at PostgreSQL 15
Looking ahead at PostgreSQL 15
Ā 
Build a Complex, Realtime Data Management App with Postgres 14!
Build a Complex, Realtime Data Management App with Postgres 14!Build a Complex, Realtime Data Management App with Postgres 14!
Build a Complex, Realtime Data Management App with Postgres 14!
Ā 
High Availability PostgreSQL on OpenShift...and more!
High Availability PostgreSQL on OpenShift...and more!High Availability PostgreSQL on OpenShift...and more!
High Availability PostgreSQL on OpenShift...and more!
Ā 
Get Your Insecure PostgreSQL Passwords to SCRAM
Get Your Insecure PostgreSQL Passwords to SCRAMGet Your Insecure PostgreSQL Passwords to SCRAM
Get Your Insecure PostgreSQL Passwords to SCRAM
Ā 
Safely Protect PostgreSQL Passwords - Tell Others to SCRAM
Safely Protect PostgreSQL Passwords - Tell Others to SCRAMSafely Protect PostgreSQL Passwords - Tell Others to SCRAM
Safely Protect PostgreSQL Passwords - Tell Others to SCRAM
Ā 
Operating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesOperating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with Kubernetes
Ā 
Building a Complex, Real-Time Data Management Application
Building a Complex, Real-Time Data Management ApplicationBuilding a Complex, Real-Time Data Management Application
Building a Complex, Real-Time Data Management Application
Ā 
Using PostgreSQL With Docker & Kubernetes - July 2018
Using PostgreSQL With Docker & Kubernetes - July 2018Using PostgreSQL With Docker & Kubernetes - July 2018
Using PostgreSQL With Docker & Kubernetes - July 2018
Ā 
An Introduction to Using PostgreSQL with Docker & Kubernetes
An Introduction to Using PostgreSQL with Docker & KubernetesAn Introduction to Using PostgreSQL with Docker & Kubernetes
An Introduction to Using PostgreSQL with Docker & Kubernetes
Ā 
Developing and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDWDeveloping and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDW
Ā 
On Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data TypesOn Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data Types
Ā 
Accelerating Local Search with PostgreSQL (KNN-Search)
Accelerating Local Search with PostgreSQL (KNN-Search)Accelerating Local Search with PostgreSQL (KNN-Search)
Accelerating Local Search with PostgreSQL (KNN-Search)
Ā 
Webscale PostgreSQL - JSONB and Horizontal Scaling Strategies
Webscale PostgreSQL - JSONB and Horizontal Scaling StrategiesWebscale PostgreSQL - JSONB and Horizontal Scaling Strategies
Webscale PostgreSQL - JSONB and Horizontal Scaling Strategies
Ā 
Indexing Complex PostgreSQL Data Types
Indexing Complex PostgreSQL Data TypesIndexing Complex PostgreSQL Data Types
Indexing Complex PostgreSQL Data Types
Ā 

Recently uploaded

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
Ā 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
Ā 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
Ā 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
Ā 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
Ā 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
Ā 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
Ā 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
Ā 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
Ā 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
Ā 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
Ā 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
Ā 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
Ā 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
Ā 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
Ā 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
Ā 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
Ā 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
Ā 

Recently uploaded (20)

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
Ā 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
Ā 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
Ā 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Ā 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
Ā 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
Ā 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
Ā 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
Ā 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
Ā 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Ā 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Ā 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
Ā 
Call Girls In Mukherjee Nagar šŸ“± 9999965857 šŸ¤© Delhi šŸ«¦ HOT AND SEXY VVIP šŸŽ SE...
Call Girls In Mukherjee Nagar šŸ“±  9999965857  šŸ¤© Delhi šŸ«¦ HOT AND SEXY VVIP šŸŽ SE...Call Girls In Mukherjee Nagar šŸ“±  9999965857  šŸ¤© Delhi šŸ«¦ HOT AND SEXY VVIP šŸŽ SE...
Call Girls In Mukherjee Nagar šŸ“± 9999965857 šŸ¤© Delhi šŸ«¦ HOT AND SEXY VVIP šŸŽ SE...
Ā 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
Ā 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
Ā 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
Ā 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
Ā 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
Ā 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Ā 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
Ā 

Vectors are the new JSON in PostgreSQL (SCaLE 21x)

  • 1. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Vectors are the new JSON Jonathan Katz (he/him/his) Principal Product Manager ā€“ Technical AWS
  • 2. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved. { "id": 5432, "name": "PostgreSQL", "description": "World's most advanced open source relational database", "supportedVersions": [16, 15, 14, 13, 12] }
  • 3. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. { "id": 5432, "name": "PostgreSQL", "description": "World's most advanced open source relational database", "supportedVersions": [16, 15, 14, 13, 12] } id 5432 name PostgreSQL description world's most... supportedVersions [16,15,14,13,12]
  • 4. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. { "id": 5432, "name": "PostgreSQL", "description": "World's most advanced open source relational database", "supportedVersions": [16, 15, 14, 13, 12] }
  • 5. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Timeline of JSON storage ā€¢ 2000-2001: JSON invented ā€¢ 2004: AJAX model emerges in wider deployments ā€¢ 2006: RFC 4627 publishes JSON format ā€¢ 2006-2009: JSON-specific data stores emerge ā€¢ 2012: PostgreSQL adds support for JSON (text) ā€¢ 2013: ECMA-404 standardizes JSON ā€¢ 2014: PostgreSQL adds support for JSONB (binary) ā€¢ 2017: SQL/JSON standard published ā€¢ 2019: PostgreSQL adds SQL/JSON path language ā€¢ 2023: PostgreSQL adds SQL/JSON constructors and predicates
  • 6. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 7. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. [0.5, 0.5]
  • 8. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Magnitude || [0.5, 0.5] || = āˆš (0.52 + 0.52) = 0.70710
  • 9. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Direction Magnitude [0.5, 0.5]
  • 10. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. [0.5, 0.5, 0.5]
  • 11. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 12. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Pre-trained on vast amounts of unstructured data Contain large number of parameters that make them capable of learning complex concepts Can be applied in a wide range of contexts Customize FMs using your data for domain specific tasks Generative AI is powered by foundation models
  • 13. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Retrieval Augmented Generation (RAG) Configure FM to interact with your data A N S W E R Q U E S T I O N K N O W L E D G E B A S E S F O U N D A T I O N M O D E L How much does a blue elephant vase cost? Product catalog Price data A blue elephant vase typically costs $19.99 Sorry, I don't know
  • 14. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. The role of vectors in RAG Document chunks Embeddings PDF document Database User Embeddings Foundational model 1 4 Question Question + Context Response 2 3 5 6 7
  • 15. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Challenges with vectors ā€¢ Time to generate embeddings ā€¢ Embedding size ā€¢ Compression ā€¢ Query time Blue elephant vase that can hold up to three plants in it, hand paintedā€¦ 0.1234 0.1231 0.1232 0.9005 0.2489 1536 dimensions 4-byte floats 6152B => 6KiB 0.12310 0.24234 0.59405 0.23430 0.23432 0.20551 0.70543 0.20559 0.20559 0.70543 0.23432 0.24234 0.23430 0.12310 0.20551 0.59405 1,000,000 => 5.7GB
  • 16. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Approximate nearest neighbor (ANN) ā€¢ Find similar vectors without searching all of them ā€¢ Faster than exact nearest neighbor ā€¢ ā€œRecallā€ ā€“ % of expected results Recall: 80%
  • 17. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Questions for choosing a vector storage system ā€¢ Where does vector storage fit into my workflow? ā€¢ How much data am I storing? ā€¢ What matters to me: storage, performance, relevancy, cost? ā€¢ What are my tradeoffs: indexing, query time, schema design?
  • 18. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. PostgreSQL as a vector store
  • 19. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Why use PostgreSQL for vector searches? ā€¢ Existing client libraries work without modification ā€¢ Convenient to co-locate app + AI/ML data in same database ā€¢ PostgreSQL acts as persistent transactional store while working with other vector search systems
  • 20. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Native vector support in PostgreSQL ā€¢ ARRAY data type Ā§ Multiple data types (int4, int8, float4, float8) Ā§ ā€œUnlimitedā€ dimensions Ā§ No native distance operations ā€“ Can add using Trusted Language Extensions + PL/Rust Ā§ No native indexing ā€¢ Cube data type Ā§ float8 values Ā§ Euclidean, Manhattan, Chebyshev distances Ā§ K-NN GiST index ā€“ exact nearest neighbor search Ā§ Limited to 100 dimensions
  • 21. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. What is pgvector? An open source extension that: adds support for storage, indexing, searching, metadata with choice of distance vector data type Supports IVFFlat/HNSW indexing Distance operators (<->, <=>, <#>) Exact nearest neighbor (K-NN) Approximate nearest neighbor (ANN) Co-locate with embeddings github.com/pgvector/pgvector
  • 22. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Understanding pgvector performance 0% 10% 20% 30% 40% 50% 60% 70% 0 5000 10000 15000 20000 25000 30000 35000 20 40 80 200 400 800 Speedup (%) Transactions/Second (TPS) hnsw.ef_search 1536-dimensional vector HNSW search db.r6g.16xlarge db.r7g.16xlarge Speedup (%)
  • 23. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. pgvector distance operations <-> Euclidean/L2 <=> Cosine distance <#> Inner product
  • 24. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. How does pgvector index a vector? 0.0234 0.093 -0.9123 0.1055 Valid? āœ… Same dimensions? āœ… Magnitude > 0? Normalized? šŸ›  If not, normalize 0.0253 0.1007 -0.9880 0.1142
  • 25. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Indexing methods: IVFFlat and HNSW ā€¢ IVFFlat Ā§ K-means based Ā§ Organize vectors into lists Ā§ Requires prepopulated data Ā§ Insert time bounded by # lists ā€¢ HNSW Ā§ Graph based Ā§ Organize vectors into ā€œneighborhoodsā€ Ā§ Iterative insertions Ā§ Insertion time increases as data in graph increases
  • 26. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Which search method do I choose? ā€¢ Exact nearest neighbors: No index ā€¢ Fast indexing: IVFFlat* ā€¢ Easy to manage: HNSW ā€¢ High performance/recall: HNSW
  • 27. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. pgvector strategies and best practices
  • 28. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Best practices for pgvector Storage strategies HNSW strategies IVFFlat strategies Filtering Distributed queries
  • 29. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. pgvector storage strategies
  • 30. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Understanding TOAST in PostgreSQL ā€¢ TOAST (The Oversized-Attribute Storage Technique) is a mechanism for storing data larger than 8KB ā€¢ By default, PostgreSQL ā€œTOASTsā€ values over 2KB ā€¢ 510-dim 4-byte float vector
  • 31. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. PostgreSQL column storage types ā€¢ PLAIN: Data stored inline with table ā€¢ EXTENDED: Data stored/compressed in TOAST table when threshold exceeded Ā§ pgvector default before 0.6.0 ā€¢ EXTERNAL: Data stored in TOAST table when threshold exceeded Ā§ pgvector default 0.6.0+ ā€¢ MAIN: Data stored compressed inline with table
  • 32. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Impact of TOAST on pgvector queries Limit (cost=772135.51..772136.73 rows=10 width=12) -> Gather Merge (cost=772135.51..1991670.17 rows=10000002 width=12) Workers Planned: 6 -> Sort (cost=771135.42..775302.08 rows=1666667 width=12) Sort Key: ((<-> embedding)) -> Parallel Seq Scan on vecs128 (cost=0.00..735119.34 rows=1666667 width=12) 128 dimensions
  • 33. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Impact of TOAST on pgvector queries Limit (cost=149970.15..149971.34 rows=10 width=12) -> Gather Merge (cost=149970.15..1347330.44 rows=10000116 width=12) Workers Planned: 4 -> Sort (cost=148970.09..155220.16 rows=2500029 width=12) Sort Key: (($1 <-> embedding)) -> Parallel Seq Scan on vecs1536 (cost=0.00..94945.36 rows=2500029 width=12) 1,536 dimensions
  • 34. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Strategies for pgvector and TOAST ā€¢ Use PLAIN storage Ā§ ALTER TABLE ā€¦ ALTER COLUMN ... SET STORAGE PLAIN Ā§ Requires table rewrite (VACUUM FULL) if data already exists Ā§ Limits vector sizes to 2,000 dimensions ā€¢ Use min_parallel_table_scan_size to induce more parallel workers
  • 35. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Impact of TOAST on pgvector queries Limit (cost=95704.33..95705.58 rows=10 width=12) -> Gather Merge (cost=95704.33..1352239.13 rows=10000111 width=12) Workers Planned: 11 -> Sort (cost=94704.11..96976.86 rows=909101 width=12) Sort Key: (($1 <-> embedding)) -> Parallel Seq Scan on vecs1536 (cost=0.00..75058.77 rows=909101 width=12) 1,536 dimensions SET min_parallel_table_scan_size TO 1
  • 36. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. HNSW strategies
  • 37. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. HNSW index building parameters ā€¢ m Ā§ Maximum number of bidirectional links between indexed vectors Ā§ Default: 16 ā€¢ ef_construction Ā§ Number of vectors to maintain in ā€œnearest neighborā€ list Ā§ Default: 64
  • 38. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building an HNSW index
  • 39. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building an HNSW index Layer 2
  • 40. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building an HNSW index Layer 2
  • 41. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building an HNSW index Layer 1
  • 42. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building an HNSW index Layer 0
  • 43. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. HNSW query parameters ā€¢ hnsw.ef_search Ā§ Number of vectors to maintain in ā€œnearest neighborā€ list Ā§ Must be greater than or equal to LIMIT
  • 44. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Querying an HNSW index Layer 2
  • 45. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Querying an HNSW index Layer 2
  • 46. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Querying an HNSW index Layer 1
  • 47. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Querying an HNSW index Layer 1
  • 48. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Querying an HNSW index Layer 0
  • 49. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Querying an HNSW index Layer 0
  • 50. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Best practices for building HNSW indexes ā€¢ Default values (M=16,ef_construction=64) usually work ā€¢ (pgvector 0.5.1) Start with empty index and use concurrent writes to accelerate builds Ā§ INSERT or COPY ā€¢ pgvector (0.6.0+) use parallel builds on a full table Ā§ max_parallel_maintenance_workers
  • 51. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Impact of parallelism on HNSW build time 0 100 200 300 400 500 600 700 800 900 1000 1 2 4 8 16 32 64 Time (s) Clients / Workers HNSW index build (1,000,000 128-dim vectors) Parallel Build Concurrent Inserts
  • 52. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Choosing m and ef_construction (serial) 0.82 0.84 0.86 0.88 0.9 0.92 0.94 0 50 100 150 200 250 32 64 128 256 512 Recall Index build (min) ef_construction 1.1MM 1536-dim vectors, m=16, ef_search=20 Build Time (min) Recall
  • 53. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Choosing m and ef_construction (parallel) 0.8 0.82 0.84 0.86 0.88 0.9 0.92 0.94 0 1 2 3 4 5 6 7 8 9 10 32 64 128 256 512 Recall Index build (min) ef_construction 1.1MM 1536-dim vectors, m=16, ef_search=20, max_maintenance_workers=64 Build time Recall
  • 54. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Choosing m and ef_construction 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0 100 200 300 400 500 600 700 800 16 24 36 48 Recall Index build (min) m 1MM 960-dim vectors Build Time (min) Recall
  • 55. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Performance strategies for HNSW queries ā€¢ Index building has biggest impact on performance/recall Ā§ More time spent optimizing build increases likelihood of finding best candidates in a neighborhood ā€¢ Increasing hnsw.ef_search increases recall, decreases performance ā€¢ Set shared_buffers to a value that keeps data (index) in memory
  • 56. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. IVFFlat strategies
  • 57. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. IVFFlat index building parameters ā€¢ lists Ā§ Number of ā€œbucketsā€ for organizing vectors Ā§ Tradeoļ¬€ between number of vectors in bucket and relevancy CREATE INDEX ON products USING ivfflat(embedding) WITH (lists=3);
  • 58. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building an IVFFlat index
  • 59. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building an IVFFlat index: Assign lists
  • 60. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Querying an IVFFlat index SET ivfflat.probes TO 1 SELECT id FROM products ORDER BY $1 <-> embedding LIMIT 3
  • 61. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Querying an IVFFlat index SET ivfflat.probes TO 2 SELECT id FROM products ORDER BY $1 <-> embedding LIMIT 3
  • 62. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Performance strategies for IVFFlat queries ā€¢ Increasing ivfflat.probes increases recall, decreases performance ā€¢ Lowering random_page_cost on a per-query basis can induce index usage ā€¢ Set shared_buffers to a value that keeps data (index) in memory ā€¢ Increase work_mem on a per-query basis
  • 63. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Best practices for building IVFFlat indexes ā€¢ Choose value of lists to maximize recall but minimize effort of search Ā§ < 1MM vectors: # vectors / 1000 Ā§ > 1MM vectors: āˆš(# vectors) ā€¢ May be necessary to rebuild when adding/modifying vectors in index ā€¢ Use parallelism to accelerate build times
  • 64. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. How parallelism works with pgvector IVFFlat Vectors in table List List List Assign to list Sequential scan
  • 65. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. How parallelism works with pgvector IVFFlat Vectors in table List List List Assign to list Parallel scan Assign to list Parallel scan Assign to list Parallel scan
  • 66. Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Using parallelism to accelerate IVFFlat builds 0 20 40 60 80 100 120 140 Serial Parallel Time (s) 1MM 768-dim, lists=1000
  • 67. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved. pgvector filtering strategies
  • 68. Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. What is filtering? SELECT id FROM products WHERE products.category_id = 7 ORDER BY :'q' <-> products.embedding LIMIT 10;
  • 69. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved. How filtering impacts ANN queries ā€¢ PostgreSQL may choose to not use the index ā€¢ Uses an index, but does not return enough results ā€¢ Filtering occurs after using the index
  • 70. Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Do I need an HNSW/IVFFlat index for a filter? ā€¢ Does the filter use a B-Tree (or other index) to reduce the data set? ā€¢ How many rows does the filter remove? ā€¢ Do I want exact results or approximate results?
  • 71. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved. Filtering strategies ā€¢ Partial index ā€¢ Partition CREATE INDEX ON docs USING hnsw(embedding vector_l2_ops) WHERE category_id = 7; --- CREATE TABLE docs_cat7 PARTITION OF docs FOR VALUES IN (7); CREATE INDEX ON docs_cat7 USING hnsw(embedding vector_l2_ops);
  • 72. Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Distributed pgvector queries
  • 73. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved. When does it make sense to distribute vector data? ā€¢ Not enough memory for workload to meet latency target ā€¢ Network overhead must be acceptable ā€¢ Can manage complexity of multi- node system
  • 74. Ā© 2023, Amazon Web Services, Inc. or its aļ¬ƒliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Setup foreign data wrapper CREATE EXTENSION IF NOT EXISTS vector; CREATE EXTENSION IF NOT EXISTS postgres_fdw; CREATE SERVER vectors1 FOREIGN DATA WRAPPER postgres_fdw OPTIONS ( async_capable 'true', extensions 'vector', dbname 'vectors', host '<NODE1>' ); CREATE SERVER vectors2 FOREIGN DATA WRAPPER postgres_fdw OPTIONS ( async_capable 'true', extensions 'vector', dbname 'vectors', host '<NODE2>' );
  • 75. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Setup foreign tables CREATE TABLE vectors ( id uuid, node_id int, embedding vector(768) ) PARTITION BY LIST(node_id); CREATE FOREIGN TABLE vectors_node1 PARTITION OF vectors FOR VALUES IN (1) SERVER vectors1 OPTIONS (schema_name 'public', table_name 'vectors'); CREATE FOREIGN TABLE vectors_node2 PARTITION OF vectors FOR VALUES IN (2) SERVER vectors2 OPTIONS (schema_name 'public', table_name 'vectors');
  • 76. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Example EXPLAIN output Limit (cost=200.01..206.45 rows=10 width=28) (actual time=18.171..18.182 rows=10 loops=1) -> Merge Append (cost=200.01..3222700.01 rows=5000000 width=28) (actual time=18.169..18.179 rows=10 loops=1) Sort Key: (('$1'::vector <=> vectors.embedding)) -> Foreign Scan on vectors_node1 vectors_1 (cost=100.00..1586350.00 rows=2500000 width=28) (actual time=8.607..8.609 rows=2 loops=1) -> Foreign Scan on vectors_node2 vectors_2 (cost=100.00..1586350.00 rows=2500000 width=28) (actual time=9.559..9.566 rows=9 loops=1) Planning Time: 0.298 ms Execution Time: 19.355 ms
  • 77. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Looking ahead
  • 78. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. pgvector roadmap ā€¢ Performance improvements for massively parallel HNSW builds (completed) ā€¢ Enhanced index-based filtering/HQANN (in progress) ā€¢ More data types per dimension (float2, uint8) (in progress) Ā§ Scalar quantization via expression indexes ā€¢ Product quantization ā€¢ Parallel query
  • 79. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Conclusion ā€¢ Like JSON, a vector is just a data type. ā€¢ Primary design decision: query performance and recall ā€¢ Determine where to invest: storage, compute, indexing strategy ā€¢ Plan for today and tomorrow: pgvector is rapidly innovating
  • 80. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Thank you! Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Please complete the session survey in the mobile app Thank you! Ā© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved. Please complete the session survey in the mobile app Jonathan Katz jkatz@amazon.com @jkatz05