Neon PostgreSQL
Set up serverless PostgreSQL with pgvector.
Neon provides serverless PostgreSQL with built-in pgvector support for vector search.
Setup
1. Create a Neon Account
- Go to neon.tech
- Sign up for a free account
- Create a new project
2. Get Connection String
- In the Neon dashboard, go to Connection Details
- Copy the connection string
- It looks like:
postgresql://user:password@ep-xxx.us-east-2.aws.neon.tech/cortex
3. Enable pgvector
Run this SQL in the Neon SQL editor:
CREATE EXTENSION IF NOT EXISTS vector;
4. Configure Cortex
Add to your .env:
DATABASE_URL=postgresql://user:password@ep-xxx.us-east-2.aws.neon.tech/cortex
5. Run Migrations
npm run db:generate
npm run db:migrate
Free Tier Limits
| Feature | Limit |
|---|---|
| Storage | 512 MB |
| Compute | 24/7 available |
| Connections | 100 concurrent |
Production Considerations
- Use connection pooling for high-traffic deployments
- Monitor storage usage (memories can grow quickly)
- Consider read replicas for heavy query loads
Neon's pgvector extension supports up to 2000 dimensions per vector. Cortex uses OpenAI's text-embedding-3-small (1536 dimensions), which fits well within this limit.