19.18 How today's tools realize it
- Approved by
- Panaversity ·
Reference. Skim it now, and come back when you choose products. Every product fact below was checked on its owner's pages on November 4, 2026.
What you will learn. How today's products realize this chapter's ideas, what each adds and does not do, and how the design stays free to move to another host.
Why it matters. The design must not depend on one provider. Knowing what each product adds, and what stays the application's job, lets you choose a host, or change it later.
The standard this section measures against is the one the concepts teach: Postgres with row-level security, a transaction-only setting for the company, and pgvector for search by meaning. The principle is portable Postgres and pgvector. The reference implementation is Neon. The lab uses four products. Each box says what the product adds, relaxes or does not do.
| Concept | The lab's product | What it adds | What to watch |
|---|---|---|---|
| The business database (19.1) | Neon: Postgres as a service | Branches made in seconds (19.6), a free plan, a database that sleeps when idle | Roles made in its dashboard skip row-level security1 (19.8). Make the connector's roles with SQL. Isolation stays the application's job |
| A connection pool online (19.17) | Cloudflare Hyperdrive, between the Worker and Neon | Pools connections across every copy, and keeps them close to the database | It caches query results by default.2 Turn caching off for company data (19.9) |
| Embeddings (19.13) | Workers AI, running bge-m3, an open-weight model | No new account if you already use Cloudflare, and a free daily allowance | 1,024 dimensions.3 The same model must embed the passages and the questions |
| Vector search (19.13) | pgvector, inside Neon | HNSW, iterative index scans from version 0.8.04 | The version depends on the Postgres version you pick (field guide F2) |
Why is Postgres the foundation?
Postgres is also the database developers use most: it came first in the 2026 Stack Overflow Developer Survey, used by 57.9% of the developers who answered.5 That matters for an AI worker's future: more people can read its data, more hosts run it, and more tools support it.
Why is Neon the reference?
Neon is serverless Postgres: you manage no server, and the database sleeps when idle (19.17). Databricks announced in May 2025 that it was buying Neon,6 and Neon's documentation now says that Neon and Databricks run the same database, Lakebase Postgres, on the same infrastructure.7 Four things make it a good fit for AI workers:
- Storage and compute are separate. The machine that runs queries holds no data of its own, so it can stop, restart or grow without risk to the data.
- Autoscaling. Compute grows and shrinks with the load, and scales to zero when idle, so a quiet database costs little. Storage is still billed. The first query after a pause is slower (19.17).
- Branching. A branch is a full copy of a database, made in seconds without copying the data: it shares the parent's stored data until something changes.8 The lab gives every pull request its own branch (19.6, 19.12).
- Managed. Neon runs the servers and the upgrades, and keeps a history of changes for restores (6 hours on the free plan).9
Neon can host every data tenancy model in 19.7: shared tables with row-level security or a schema per company inside one project, or a project per company. It does not make isolation correct. The roles, the policies, the transaction-only company and the tests are the application's, which is why the concepts teach them without naming any host.
How does the design stay portable?
The lab keeps four rules, so the business data and its rules never depend on one provider:
- The migrations are plain Postgres SQL. Nothing in them is Neon's own.
- The roles and policies are made with SQL, in a migration, never in a dashboard.
- The connector reaches the database only through a connection string kept outside the code. Neon's own tools appear only in the build scripts and CI, which make and delete branches.
- The checks are plain Postgres: the role check, the query check, the data matrix and the question set.
Moving to another Postgres host that offers pgvector then takes a new connection string, one run of the migrations, a copy of the rows (a standard Postgres dump of the business database, made by the owner), and the checks. If the role check and the data matrix pass, the move is done.
Anthropic. Anthropic does not make an embeddings model. Its documentation says so, points to Voyage AI as one provider, and advises assessing several.10 Claude reaches business data only through a connector: in Claude Code, in the Claude apps, through the Messages API's connector support and in hosted agents (Chapter 20), the model calls search_policy and the other tools, and the connector, not the model, talks to the database. Nothing in this chapter gives Claude SQL. Status and price. Voyage's current models include voyage-4-lite, at $0.02 per million tokens after the first 200 million tokens free per account.11 Its hosted models make 1,024 dimensions by default. Choosing Voyage would mean a second account and key, and embedding every passage again.
OpenAI. OpenAI makes embeddings models, text-embedding-3-small (1,536 dimensions by default) and text-embedding-3-large (3,072), with a setting to shorten them.12 It also runs retrieval for you: its file search tool in the Responses API searches files you upload to its vector stores.13 That is the main alternative to this chapter's design: OpenAI holds the documents and the index. You then cannot put the company in a database policy. OpenAI lets you filter one store by file attributes, but then the AI app must apply the filter every time, so this chapter would keep each company's documents in a separate vector store, and prove that separation another way. Status and price. text-embedding-3-small costs $0.02 per million tokens.14 File search is billed for storage and for calls, on OpenAI's pricing page.
Open source. Postgres and pgvector are open source, and every concept in this chapter runs on a Postgres you install yourself. Every offline step of the lab has been run on Postgres 16.15 with pgvector 0.6.0 on one computer. That version has no iterative scans, which the hosted versions do. bge-m3 is open weight, so the same model can run on your own hardware, and the stored embeddings stay comparable. Security. With your own Postgres, every role is yours to make, so the rule is the same: the connector's role is made with SQL, with no bypass right, and the role check runs against it. Status and price. Free software. You pay for the computer it runs on.
What do the free plans give?
The lab's services and their free plans, as checked:
- Neon: free, with no card required. 100 projects, 10 branches per project, 1 GB of storage per project, 100 compute-hours per project per month, and the database stops after 5 minutes idle, which cannot be turned off on the free plan.15 It supports Postgres 14 to 18.16 pgvector is 0.8.0 on Postgres 14 to 17, and 0.8.6 on Postgres 18.17 Its pooled connection addresses (with
-pooler) do not support session-levelSET18 (the connection-wide setting of 19.9): a setting may outlive the transaction and reach another client's queries. This chapter's transaction-only setting is the safe kind. - Hyperdrive: included in the free Workers plan, with 100,000 queries a day,19 10 configurations, and about 20 connections to the database per configuration.20 It pools in transaction mode (a connection goes back to the pool after each transaction) and resets each connection when it returns to the pool.21 It caches read-only results for 60 seconds by default.
wrangler hyperdrive create --caching-disabledturns that off.22 - Workers AI: 10,000 neurons (Cloudflare's unit of use) a day free. bge-m3 costs 1,075 neurons per million input tokens, so the free allowance covers about nine million tokens a day. Paid use is $0.011 per thousand neurons.23
What differs between hosted retrieval and retrieval you run?
Hosted retrieval (OpenAI's file search) against retrieval you run (this chapter):
| Retrieval you run | Hosted retrieval | |
|---|---|---|
| Who holds the documents | Your database | The provider |
| Where the company is enforced | A database policy on every row, tested by the data matrix | Which store you search. Your code must pick the right one every time |
| What you can test | Every row, every role, every query, in CI | The answers you get back |
| What it costs | A small database and an embeddings model | Storage and calls |
What must stay true on any host?
The database decides which company's rows a request may see, from a company set for that one transaction by code that read it from a verified token. No role the connector uses can skip that, and no query, cache or error lets one company learn anything about another.
Exam note. Retrieval appears in the Claude developer certification exam (CCDV-F) as context management. Data from one customer reaching another is examined under injection, untrusted input and leakage. The exam examines Claude, not these products.
Check yourself
Question 1 / 8
0 answered
According to Neon's documentation, why must the connector's roles not be made in Neon's dashboard?
Sources
- pgvector README, pgvector.↑
- 2026 Developer Survey: Technology, Stack Overflow.↑
- Databricks agrees to acquire Neon, Databricks.↑
- Neon architecture, Neon.↑
- Branching, Neon.↑
- Backup and restore, Neon.↑
- Embeddings, Anthropic.↑
- Pricing, Voyage AI.↑
- Embeddings, OpenAI.↑
- File search, OpenAI.↑
- text-embedding-3-small, OpenAI.↑
- Plans, Neon.↑
- Postgres version policy, Neon.↑
- Postgres extensions, Neon.↑
- Connection pooling, Neon.↑
- Hyperdrive pricing, Cloudflare.↑
- Hyperdrive limits, Cloudflare.↑
- How Hyperdrive works, Cloudflare.↑
- Wrangler Hyperdrive commands, Cloudflare.↑
- Workers AI pricing, Cloudflare.↑
- Owner
- Panaversity