pgvector for Small Business Search and Knowledge Tools
How pgvector stores and searches embeddings in PostgreSQL, and how MILabs sets it up for a small business.
Updated 2026-10-09
What pgvector is
pgvector is an open-source extension for PostgreSQL, the widely used relational database. It adds a vector data type, so numerical representations of text, images or other content, usually called embeddings, can be stored in the same tables as the rest of a business's records. The extension also provides operators for measuring how close two vectors are, including Euclidean distance, inner product and cosine distance. A query can run as an exact search that returns the true nearest matches, or it can use an approximate index such as HNSW or IVFFlat, which trades a small loss of accuracy for speed on large tables. Because it runs inside PostgreSQL, pgvector uses the same permissions, transactions and backups the database already has. An application or model provider generates the embeddings, and pgvector stores and searches them. That keeps the setup simpler, since one database holds both the records and the search.
pgvector in plain language
A keyword search only finds the words a person typed. If a staff member searches a policy manual for "leave for a sick child", a clause about "carer's leave" may never surface, though it answers the question. An embedding model turns each passage into a list of numbers that reflects its meaning, so passages on similar ideas sit close together. A question is converted the same way, and the nearest stored passages are the likely matches.
The harder question for a small business is where those numbers should live. A separate vector database adds another system to secure and maintain. pgvector sidesteps that by running inside PostgreSQL, so one query can filter by customer or date while ranking results by similarity.
The trade-off is that pgvector only stores and searches, with no grasp of language of its own. Someone must decide how documents are split into passages, which model produces the vectors, and how they are refreshed when source files change. Vectors from different models cannot be compared, so swapping models means regenerating the whole store. Neglecting these steps yields answers that look plausible but rest on stale or badly divided text.
What businesses use it for
- Searching internal policies, manuals and past proposals by meaning rather than exact keywords
- Storing product or service descriptions so an assistant can suggest the closest matches to a customer's request
- Finding the most similar past enquiries, tickets or quotes before a staff member replies
- Keeping customer and supplier records searchable alongside the data a business already holds in PostgreSQL
- Checking new documents against a library of earlier contracts or compliance requirements
Who it suits
- Businesses that already run PostgreSQL and want search without a second database
- Teams with large libraries of documents, enquiries or product records to search by meaning
- Owners who need their data to stay under their own control and hosting
How MILabs sets it up
MILabs begins by agreeing with the owner or team lead what the vector store should hold, which records it should search, and who uses the results. We then confirm whether the business already runs a PostgreSQL database or whether a hosted Postgres service suits better, and agree the hosting arrangement with the owner. Next we connect the systems the business already has, such as document folders, the CRM or the helpdesk, and set up the job that creates embeddings and writes them to pgvector. Access is limited by role, so staff see only the records their work requires, and an index is chosen for the size of the data. Finally we agree who looks after the database, watches its backups and updates the embedding model when it changes.
Builds it fits
Industries it fits
pgvector in practice
In day-to-day use, a staff member types a question into an internal search box or assistant window. The application turns that question into an embedding, pgvector returns the closest passages from the store, and a language model drafts an answer using only those passages. The reply should show which document and section each claim came from, so the person can open the original and confirm it before acting on it.
Picture a bookkeeping team with years of client correspondence and procedure notes. A junior bookkeeper asking how to record a mid-year change in a client's billing terms would see the relevant procedure note and the related emails, while notes marked for senior review stay out of that person's results. The filter can run in the database query itself, so the restriction holds for every answer the assistant produces.
The work after launch is largely upkeep. Someone keeps a short log of questions that returned weak matches, and reviews it on a regular schedule to decide whether a document needs splitting differently, a missing file needs adding, or a superseded policy should be archived. Old versions left in the store can keep surfacing with confident-looking answers, so retiring them is as important as adding new material.
Frequently asked questions
- What is pgvector?
- pgvector is an open-source extension for PostgreSQL that adds a vector data type and similarity search. It stores embeddings, numerical forms of text or other content, and finds the stored items closest in meaning to a query. Searches can be exact or use an HNSW or IVFFlat index. It is a storage and search layer, so an AI model or application is needed to create embeddings and write the answer.
- Can I self-host pgvector?
- Yes. pgvector is open source and runs on a PostgreSQL server the business controls, whether on its own hardware or in a cloud account it manages. Either way, MILabs confirms the hosting arrangement with the owner before any data moves, so the business knows where its records live and who can reach them. The owner keeps control throughout.
- Which builds work well with pgvector?
- Builds that search a body of text by meaning fit best. A staff knowledge assistant can find the relevant section of a policy manual, and a document question-answering assistant can draw on contracts or reports stored in a private server. Product recommendation and tender bid assistants also rely on similarity search. Automations that only move records between systems rarely need a vector store, so other tools usually serve them better.
- How do I get my team to use pgvector?
- Staff rarely interact with pgvector directly. They use the assistant or search screen built on top of it, so adoption depends on that interface. Start with one task the team already repeats, such as finding the right policy clause, and show how each answer links back to its source document. Name one person to review results during early use and collect feedback. MILabs can help the owner plan that rollout.
- How does MILabs set up pgvector?
- MILabs sets up pgvector as part of a larger build rather than as a standalone install. The work begins with the owner, who decides which records should be searchable and who may see them. The team then connects the business's existing systems, creates the embedding job and chooses an index that suits the size of the data. Access rules, backups and a named person for ongoing upkeep are agreed before handover.
