ladderlore
လမ်းညွှန် တောင်းဆိုရန်
  • S3 သို့မဟုတ် IAM လို service အမည်ကို ရိုက်ထည့်ပါ။

သဘောတရား · AIF-C01 အပေါ် ဆက်လေ့လာရန်

Aurora and RDS PostgreSQL with pgvector

Vectors in PostgreSQL: column, HNSW or IVFFlat index, distance operators, one query with filters.

ဒီသင်ခန်းစာကို မြန်မာဘာသာ မပြန်ရသေးလို့ အင်္ဂလိပ်လို ပြထားပါတယ်။

AI Practitioner မှ သင်သိပြီးသားများ

  • Aurora PostgreSQL can store vectors next to your rows.
  • It answers vector search with SQL.
  • OpenSearch is the separate option built for search at scale.
AI Practitioner သင်ခန်းစာကို ဖတ်ရန်
Application
One SQL query
Aurora PostgreSQL
Filter rows
Nearest vectors
  1. 1The application sends one SQL statement.
  2. 2It names a distance operator and an optional filter.
  3. 3Aurora applies the filter on normal columns.
  4. 4It ranks the remaining rows by vector distance.
One SQL query filters rows and ranks by distance.

အဆင့်ဆင့်

  1. 1The application sends one SQL statement.
  2. 2It names a distance operator and an optional filter.
  3. 3Aurora applies the filter on normal columns.
  4. 4It ranks the remaining rows by vector distance.

One SQL query filters rows and ranks by distance.

  • Build

    HNSW
    Slower, no training
    IVFFlat
    Faster, after data load
  • Recall

    HNSW
    Better
    IVFFlat
    Good, tune probes
  • Memory

    HNSW
    Higher
    IVFFlat
    Lower
  • Query setting

    HNSW
    hnsw.ef_search
    IVFFlat
    ivfflat.probes
HNSW and IVFFlat indexes compared.

ဘာလဲ

Turn it on with CREATE EXTENSION vector. Then add a column of type vector(n), where n is the model output size, for example vector(1024). Distance operators are <-> for L2 distance, <=> for cosine distance and <#> for negative inner product. An ORDER BY with the operator and a LIMIT returns the nearest rows. Without an index the search scans every row: exact, but slow on large tables.

ဘာလဲ

Two index types make it approximate and fast. HNSW builds a graph: slower to build and heavier on memory, with better recall and speed, no training needed, and a tuning knob at query time (hnsw.ef_search). IVFFlat splits vectors into lists: faster to build and lighter, but build it after the table has data, and raise the probes setting at query time for better recall. Indexes cover vectors of up to 2,000 dimensions.

ဘာလဲ

The strength is one query over vectors and ordinary columns: WHERE tenant_id = 7 AND created_at > ... ORDER BY embedding <=> query LIMIT 5. A selective filter can leave an approximate index with fewer results than the limit, and newer pgvector versions add iterative scans to fix that. Choose pgvector when vectors belong with relational data, the scale is moderate and you already run PostgreSQL. Choose a separate store for very large or search-heavy loads.

မှတ်ထားရန်

  • CREATE EXTENSION vector, then a vector(n) column. n must match the model.
  • Operators: <-> L2, <=> cosine, <#> negative inner product.
  • HNSW: better recall, slower build, more memory. IVFFlat: faster build, build after loading data.
  • Indexes cover up to 2,000 dimensions.
  • One SQL query can filter relational columns and rank by distance.

မှတ်ထားရန်

  • Selective filters can return fewer than k rows from an approximate index.

စာမေးပွဲမှာ

  • “Find similar items and filter by tenant in one SQL statement” points to pgvector in Aurora PostgreSQL.
  • “Better recall with no training step” points to an HNSW index.
  • “Faster index build on loaded data with lower memory” points to IVFFlat.