new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Supabase · all subjects

ai-tools/vector-architecture

75 notes in this subject, read out of this brain and free to use. This is page 2 of 2.

IVFFlat index creation for different operators

To create an IVFFlat index for Euclidean distance: 'create index on items using ivfflat (column_name vector_l2_ops) with (lists = 100);'. For inner product: 'create index on items using ivfflat (column_name vector_ip_ops) with (lists = 100);'. For cosine distance: 'create index on items using ivfflat (column_name vector_cosine_ops) with (lists = 100);'. Vectors with up to 2,000 dimensions can be indexed.

IVFFlat inverted lists parameter

When creating an IVFFlat index, you specify the number of inverted lists (cell clusters) using the 'lists' parameter. Increasing this number speeds up queries but reduces recall. For example: 'with (lists = 100)' creates 100 inverted lists.

IVFFlat probes setting for query performance

For IVFFlat queries, you can set the number of probes (default is 1) to control how many nearby cells are probed for matches. Increasing probes improves recall but reduces speed. Set probes for the session with 'set ivfflat.probes = 10;' or for a single transaction with 'begin; set local ivfflat.probes = 10;'.

IVFFlat index and exact nearest neighbor search

If the number of probes is set equal to the number of lists in an IVFFlat index, exact nearest neighbor search will be performed and the planner won't use the index.

IVFFlat approximate nearest neighbor search behavior

IVFFlat performs approximate nearest neighbor search because exact search on high-dimensional data cannot be efficiently indexed. This means similarity results will change slightly after adding an index, as the system trades recall for speed.

When to create IVFFlat indexes

Build IVFFlat indexes only after the table has sufficient data so that internal IVFFlat cell clusters are based on the data's distribution. When data distribution changes significantly, consider rebuilding indexes.

IVFFlat index overview

IVFFlat is a type of vector index for approximate nearest neighbor search that improves performance when querying high-dimensional vectors like embeddings. Supabase recommends using HNSW indexes instead of IVFFlat for better performance and robustness against changing data, unless you have a specific use case requiring IVFFlat.

Create index on Supabase Vector collection

Call collection.create_index() to index the collection for fast search performance after upserting records.

Supabase project setup includes pgvector extension

Every Supabase project created at database.new comes with a full Postgres database and the pgvector extension preconfigured for vector storage.

Supabase Vector collection creation and configuration

Create or retrieve a vector collection using vecs.get_or_create_collection(name='collection_name', dimension=1024). This collection stores vectors with their identifiers and associated metadata.

Upsert records into Supabase Vector collection

Use collection.upsert() with a list of tuples, each containing: (identifier_string, vector_array_or_list, metadata_dict). Example: ('one.jpg', img_emb1, {'type': 'jpg'}).

Query Supabase Vector collection with filters

Use collection.query(data=embedding_vector, limit=n, filters={'field': {'$eq': 'value'}}) to search with metadata filtering. The filters parameter uses MongoDB-style query syntax like {'type': {'$eq': 'jpg'}}.

Supabase Vecs client connection code example

To connect to a Supabase database with the Vecs Python client, import vecs and create a client using the Session pooler connection string. Example: import vecs DB_CONNECTION = "postgresql://<user>:<pa••••••d>@<host>:<port>/<db_name>" # create vector store client vx = vecs.create_client(DB_CONNECTION)

Hello World AI quickstart with Supabase Vecs

The Hello World guide teaches how to use Supabase Vecs to create and manage vector collections. The guide covers: launching a Postgres database that uses pgvector to store embeddings, launching a notebook that connects to the database, creating a vector collection, adding data to the collection, and querying the collection.

Supabase Session pooler connection string format

The Session pooler connection string for Supabase has the format: ``` postgresql://postgres.[PROJECT-REF]:[PASSWORD]@aws-0-[REGION].pooler.supabase.com:5432/postgres ``` To obtain this connection string: 1. Go to Project → Settings → Database → Connection Pooling 2. Select Session pooler (port 5432) The connection string components are: - **PROJECT-REF**: Your Supabase project reference - **PASSWORD**: Your database password - **REGION**: The AWS region where your database is hosted (e.g., us-east-1)

Give your agent this brain