{
 "kind": "api",
 "slug": "pgvector",
 "path": "apis/pgvector/",
 "name": "pgvector",
 "logo": "https://agentgid.com/media/avatars/pgvector.png",
 "maker": "pgvector (open source project)",
 "density": "full",
 "crumbs": [
  [
   "APIs",
   "apis/"
  ],
  [
   "Vector databases",
   "apis/vector-db/"
  ]
 ],
 "lead": "Search by meaning inside your Postgres database.",
 "chips": [
  {
   "label": "Vector databases",
   "path": "apis/vector-db/"
  }
 ],
 "primary": {
  "label": "Copy prompt for your agent",
  "copy": "Add pgvector to my Postgres: enable the extension, add an embedding column sized to my embedding model, add an HNSW index with the matching distance ops, and query with ORDER BY distance and LIMIT from server code."
 },
 "links": [
  {
   "label": "Website",
   "href": "https://github.com/pgvector/pgvector"
  },
  {
   "label": "GitHub",
   "href": "https://github.com/pgvector/pgvector"
  }
 ],
 "track": "Outages, price changes and new versions on your dashboard",
 "verdicts": [
  {
   "key": "price",
   "label": "Price",
   "value": "Open source",
   "status": "yes",
   "sub": "Run it yourself for free",
   "quote": null,
   "note": "No free tier on the pricing page. As reported on the official pricing page, checked Oct 10, 2026.",
   "src": "https://github.com/pgvector/pgvector"
  },
  {
   "key": "commercial",
   "label": "Commercial use",
   "value": "Allowed",
   "status": "yes",
   "sub": null,
   "quote": "Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted",
   "note": "Use for any purpose without fee under the PostgreSQL License.",
   "src": "https://github.com/pgvector/pgvector/blob/master/LICENSE"
  },
  {
   "key": "key",
   "label": "Key & sign-up",
   "value": "API key, server only",
   "status": "info",
   "sub": "Env var none from pgvector; Postgres client libraries read PGHOST, PGUSER and PGPASSWORD (or a connection string you pass)",
   "quote": "PGPASSWORD behaves the same as the password connection parameter.",
   "note": "No pgvector account or key. Your app connects to your own Postgres database with its user and password. The database password must stay on your server; pgvector is reached through a Postgres client, not from browser code.",
   "src": "https://www.postgresql.org/docs/current/libpq-envars.html"
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "info",
   "sub": "llms.txt · SDK",
   "quote": null,
   "note": " Our agent check: 3 of 6 (Nov 13, 2026).",
   "src": "https://github.com/llms.txt"
  }
 ],
 "vfoot": "Checked against the maker's official pages, pricing on Oct 10, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What pgvector does",
   "parts": [
    {
     "t": "prose",
     "text": "pgvector is a free add-on for the Postgres database, not an online service with its own key. It lets your database store embeddings, lists of numbers that describe the meaning of a text or picture, next to your normal rows. Then one query finds the rows closest in meaning, such as similar products or matching help articles."
    },
    {
     "t": "list",
     "items": [
      "pgvector is one of 24 APIs in the Vector databases category on AgentGid.",
      "It is one of 19 that can be started for free.",
      "13 of them ship an official MCP server; pgvector does not.",
      "Its official SDK is the 3rd most downloaded in the category (11.4M a week)."
     ],
     "muted": true
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Answers from your own documents",
       "text": "Store your help articles or notes with their embeddings, find the passages closest to a question, and give them to an AI model to answer from.",
       "idea": false
      },
      {
       "title": "Similar products on a shop page",
       "text": "Show \"you may also like\" items whose descriptions or photos are closest to the one a shopper is looking at.",
       "idea": false
      },
      {
       "title": "Search inside one customer's data",
       "text": "In an app with many customers, each search looks only at that customer's rows, and the closest matches still come back first.",
       "idea": false
      },
      {
       "title": "Keyword and meaning search together",
       "text": "Combine normal word search with search by meaning, so exact product codes and loosely worded questions both find the right page.",
       "idea": false
      },
      {
       "title": "Find pictures that look alike",
       "text": "Store an embedding for every uploaded image and find the ones that look closest to a new picture.",
       "idea": false
      },
      {
       "title": "Spot duplicate support tickets",
       "text": "When a new ticket comes in, look up earlier tickets with the closest meaning and link them, so the team answers once.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "pgvector popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "12.1M",
       "l": "SDK downloads a week",
       "d": "+20.1% on the 4-week average",
       "up": true
      },
      {
       "n": "209",
       "l": "public agent repos use its SDK"
      },
      {
       "n": "23.8K",
       "l": "GitHub stars, pgvector/pgvector"
      }
     ]
    },
    {
     "t": "small",
     "text": "SDK downloads from npm and PyPI, weekly. Numbers as of Nov 17, 2026."
    }
   ]
  },
  {
   "id": "pricing",
   "nav": "Pricing and limits",
   "h2": "Pricing",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Free tier",
       "v": "None"
      },
      {
       "l": "Cheapest plan",
       "v": "No monthly plan"
      },
      {
       "l": "Usage price",
       "v": "—"
      },
      {
       "l": "Plans",
       "v": "Free extension; available on most managed Postgres services (pricing is the host's)."
      }
     ]
    },
    {
     "t": "small",
     "text": "As reported on the official pricing page, checked Oct 10, 2026. Prices change: confirm before you buy.",
     "link": "",
     "href": null
    }
   ]
  },
  {
   "id": "limits",
   "nav": null,
   "spy_as": "pricing",
   "h2": "Limits",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "All installs (open source)",
       "v": "A vector column holds up to 16,000 dimensions",
       "src": "https://github.com/pgvector/pgvector/blob/master/README.md"
      },
      {
       "l": "All installs (open source)",
       "v": "HNSW and IVFFlat indexes on the vector type cover up to 2,000 dimensions (halfvec up to 4,000)",
       "src": "https://github.com/pgvector/pgvector/blob/master/README.md"
      },
      {
       "l": "All installs (open source)",
       "v": "Postgres 13 or newer",
       "src": "https://github.com/pgvector/pgvector/blob/master/README.md"
      }
     ]
    },
    {
     "t": "small",
     "text": "From the official docs.",
     "link": "github.com/pgvector/pgvector/blob/master/README.md",
     "href": "https://github.com/pgvector/pgvector/blob/master/README.md"
    }
   ]
  },
  {
   "id": "access",
   "nav": "Access and terms",
   "h2": "Key and access",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "How it signs in",
       "v": "No pgvector account or key. Your app connects to your own Postgres database with its user and password."
      },
      {
       "l": "Environment variable",
       "v": "none from pgvector; Postgres client libraries read PGHOST, PGUSER and PGPASSWORD (or a connection string you pass)",
       "code": true
      },
      {
       "l": "Safe in browser code",
       "v": "No, keep it on your server",
       "status": "no"
      },
      {
       "l": "Card at sign-up",
       "v": "No"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Steps only a person can do"
    },
    {
     "t": "list",
     "items": [
      "Choose where the database runs (a hosted Postgres that offers pgvector, or your own server) and create a database user. Read the connection details from .env on the server and run CREATE EXTENSION vector once per database.",
      "Pick the embedding model or service that will turn your texts or images into numbers (it may need its own paid key). Size the vector column to that model's number of dimensions."
     ]
    }
   ]
  },
  {
   "id": "terms",
   "nav": null,
   "spy_as": "access",
   "h2": "Commercial use and your data",
   "parts": [
    {
     "t": "prose",
     "text": "Free and open source under the PostgreSQL License. You may use, change and pass it on for any purpose, also in paid products, as long as the copyright notice stays in copies."
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In a paid app",
       "v": "Yes",
       "status": "yes",
       "sub": "Use for any purpose without fee under the PostgreSQL License.",
       "quote": "Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted",
       "src": "https://github.com/pgvector/pgvector/blob/master/LICENSE"
      },
      {
       "l": "redistribute-files",
       "v": "With conditions",
       "status": "cond",
       "sub": "Shipping pgvector itself (for example in a database image) is allowed if the copyright notice and license paragraphs stay in the copies.",
       "quote": "provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.",
       "src": "https://github.com/pgvector/pgvector/blob/master/LICENSE"
      },
      {
       "l": "client-work",
       "v": "Yes",
       "status": "yes",
       "sub": "Any purpose is allowed, paid or not.",
       "quote": "Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted",
       "src": "https://github.com/pgvector/pgvector/blob/master/LICENSE"
      }
     ]
    }
   ]
  },
  {
   "id": "errors",
   "nav": null,
   "spy_as": "access",
   "h2": "Errors to handle",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "fatal error: postgres.h: No such file or directory",
       "v": "Building pgvector failed because the Postgres development files are missing.",
       "sub": "Install the server development package for your Postgres version (for example postgresql-server-dev-18), then build again."
      },
      {
       "l": "Illegal instruction",
       "v": "The extension was compiled on one machine with native CPU flags and run on another.",
       "sub": "Rebuild with make OPTFLAGS=\"\" for a portable build."
      },
      {
       "l": "Fewer results after adding an HNSW index",
       "v": "The search list (hnsw.ef_search) is 40 by default, and filters are applied after the index scan.",
       "sub": "Turn on iterative index scans (SET hnsw.iterative_scan = strict_order) or raise hnsw.ef_search."
      },
      {
       "l": "Query does not use the vector index",
       "v": "The query sorts by an expression or has no LIMIT.",
       "sub": "ORDER BY the distance operator itself, ascending, with a LIMIT."
      }
     ]
    }
   ]
  },
  {
   "id": "agent",
   "nav": "For agents",
   "h2": "Use it from an agent",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Our agent check",
       "v": "3 of 6: llms.txt yes, OpenAPI no, SDK yes, MCP no, status page no, AI assistants allowed yes",
       "sub": "Checked Nov 13, 2026."
      },
      {
       "l": "MCP server",
       "v": "None found",
       "sub": null
      },
      {
       "l": "npm",
       "v": "npm install pgvector",
       "code": true
      },
      {
       "l": "PyPI",
       "v": "pip install pgvector",
       "code": true
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "pgvector",
       "me": true,
       "facts": [
        "Free (open source)",
        "No free tier"
       ]
      },
      {
       "name": "Supabase (pgvector)",
       "why": "Pick Supabase when you want hosted Postgres with pgvector already there, plus sign-in, file storage and ready APIs.",
       "path": "apis/supabase-pgvector/",
       "facts": [
        "Free (open source)",
        "Free tier",
        "Official MCP"
       ]
      },
      {
       "name": "Qdrant Cloud",
       "why": "Pick Qdrant Cloud when you want a separate managed search engine built only for vectors.",
       "path": "apis/qdrant-cloud/",
       "facts": [
        "Free (open source)",
        "Free tier",
        "Official MCP"
       ]
      },
      {
       "name": "LanceDB",
       "why": "Pick LanceDB when you want vector search embedded in your app or in its cloud, without running Postgres.",
       "path": "apis/lancedb/",
       "facts": [
        "See its page",
        "No free tier"
       ]
      }
     ],
     "more": "All vector databases APIs",
     "more_path": "apis/vector-db/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Add pgvector to my Postgres: enable the extension, add an embedding column sized to my embedding model, add an HNSW index with the matching distance ops, and query with ORDER BY distance and LIMIT from server code."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Install the extension on your Postgres server (or pick a hosted Postgres that already has it).",
       "code": "cd /tmp\ngit clone --branch v0.8.7 https://github.com/pgvector/pgvector.git\ncd pgvector\nmake\nmake install # may need sudo",
       "src": "https://github.com/pgvector/pgvector/blob/master/README.md"
      },
      {
       "text": "Turn it on once in each database that should use it.",
       "code": "CREATE EXTENSION vector;",
       "src": "https://github.com/pgvector/pgvector/blob/master/README.md"
      },
      {
       "text": "Add a vector column and search for the nearest rows.",
       "code": "CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));\nSELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5;",
       "src": "https://github.com/pgvector/pgvector/blob/master/README.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "First request"
    },
    {
     "t": "tabs",
     "label": "First request",
     "items": [
      {
       "tab": "Request",
       "code": "CREATE EXTENSION vector;\nCREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));\nINSERT INTO items (embedding) VALUES ('[1,2,3]'), ('[4,5,6]');\nSELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5;",
       "intro": "pgvector has no hosted service; this is the Getting Started SQL from the README, and the response is from our own run of it in PGlite 0.5.16 with pgvector 0.8.7."
      },
      {
       "tab": "Response",
       "code": "[{\"id\":1,\"embedding\":\"[1,2,3]\"},{\"id\":2,\"embedding\":\"[4,5,6]\"}]"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "Sorting by 1 - cosine distance DESC to get the most similar rows.",
       "fix": "ORDER BY the cosine distance operator itself, ascending, with LIMIT, and compute similarity in the SELECT list.",
       "why": "An expression in ORDER BY stops Postgres from using the vector index."
      },
      {
       "dont": "Creating an IVFFlat index on an empty table right after CREATE TABLE.",
       "fix": "Load data first, then create the IVFFlat index (or use HNSW, which needs no data to build).",
       "why": "An IVFFlat index built with too little data returns fewer results."
      },
      {
       "dont": "An HNSW index on vector(3072) for a large embedding model.",
       "fix": "Store halfvec(3072) or index an expression cast to halfvec, which indexes up to 4,000 dimensions.",
       "why": "Indexes on the vector type stop at 2,000 dimensions."
      },
      {
       "dont": "Building the index with one distance and querying with another.",
       "fix": "Match the ops class to the operator, for example vector_cosine_ops for cosine distance queries.",
       "why": "Each distance function needs its own index."
      },
      {
       "dont": "Passing Python lists to psycopg without registering the vector type.",
       "fix": "Call register_vector(conn) after connecting (or in the pool's configure callback).",
       "why": "The Python helper needs the types registered on each connection."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Do I need an account or a key for pgvector?",
       "a": "No. It is a free extension that runs inside your own Postgres; you only need the database login.",
       "evidence": {
        "url": "https://github.com/pgvector/pgvector/blob/master/README.md",
        "quote": "Use pgvector from any language with a Postgres client."
       }
      },
      {
       "q": "Which programming languages can use it?",
       "a": "Any language with a Postgres client; the project keeps helper libraries for Python, JavaScript, Go, Ruby and many more.",
       "evidence": {
        "url": "https://github.com/pgvector/pgvector/blob/master/README.md",
        "quote": "You can even generate and store vectors in one language and query them in another."
       }
      },
      {
       "q": "My embeddings have 3,072 numbers. Can I index them?",
       "a": "The vector type indexes up to 2,000 dimensions; use half-precision vectors (up to 4,000) or binary quantization for more.",
       "evidence": {
        "url": "https://github.com/pgvector/pgvector/blob/master/README.md",
        "quote": "You can use half-precision vectors or half-precision indexing to index up to 4,000 dimensions or binary quantization to index up to 64,000 dimensions."
       }
      },
      {
       "q": "Does it work with backups and replicas?",
       "a": "Yes. It uses the Postgres write-ahead log, so replication and point-in-time recovery work.",
       "evidence": {
        "url": "https://github.com/pgvector/pgvector/blob/master/README.md",
        "quote": "Yes, pgvector uses the write-ahead log (WAL), which allows for replication and point-in-time recovery."
       }
      },
      {
       "q": "How do I update it later?",
       "a": "Install the new version the same way, then run ALTER EXTENSION vector UPDATE in each database.",
       "evidence": {
        "url": "https://github.com/pgvector/pgvector/blob/master/README.md",
        "quote": "Install the latest version (use the same method as the original installation)."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Maker",
   "pgvector (open source project)"
  ],
  [
   "Category",
   "Vector databases"
  ],
  [
   "Price",
   "Free (open source)"
  ],
  [
   "Official SDK",
   "npm pgvector, PyPI pgvector"
  ],
  [
   "Latest SDK",
   "0.8.7 on npm"
  ],
  [
   "Agent check",
   "3 of 6"
  ],
  [
   "Pricing checked",
   "Oct 10, 2026"
  ]
 ],
 "good": [
  "It is not a hosted service. You need a Postgres database where pgvector is installed, your own or from a hosting provider.",
  "pgvector does not make embeddings. You create them with a separate model or service and store the numbers.",
  "Without an index every search compares all rows, which is exact but slower on large tables. An index is faster but may miss a few matches."
 ],
 "checked_line": "Read by AgentGid from 12 official pages, card checked Nov 10, 2026; usage numbers update daily."
}