# Postgres (Neon) Per-tenant Postgres database on Neon. Execute SQL over HTTP — no Postgres setup, no connection pool to manage, no credentials to rotate. Public for all tenants; existing `database` (D1/SQLite) tenants are unaffected. ## Prerequisites Provision this resource before use. Edge requests without provisioning will error. ### Provision curl -s -X POST https://cohesivity.ai/api/resources/postgres \ -H "Authorization: Bearer " ### Delete curl -s -X DELETE https://cohesivity.ai/api/resources/postgres \ -H "Authorization: Bearer " **Important:** Provision this resource now, before building or running the application. Provisioning is the agent's job, not the application's. ## Relationship to /database This is a separate offering from `database` (SQLite/D1). Both can coexist on the same tenant. `database` and `postgres` have different SQL dialects, different parameter placeholders, and different metrics — pick one per use case. - `database` (D1/SQLite): rows-based billing, `?` placeholders, edge-colocated, single-threaded writer, ~10 GB hard cap. - `postgres` (Neon): compute/storage/transfer billing, `$1` placeholders, regional, autoscaling compute, per-tier storage ceiling. Realtime and social-login auto-provision `database` for their event tables and continue to do so independent of whether the tenant has provisioned `postgres`. ## SQL Dialect This is **PostgreSQL**, not SQLite. Key differences from `database`: - Use `BIGSERIAL` or `GENERATED ALWAYS AS IDENTITY` instead of `INTEGER PRIMARY KEY AUTOINCREMENT` - Use `$1`, `$2`, ... parameter placeholders, not `?` or `?1` - `TIMESTAMPTZ`, `JSONB`, `TEXT[]`, `ILIKE` all available - `NOW()` works in DEFAULT clauses - One statement per request at v1 — multi-statement SQL is not supported (this is a deliberate v1 restriction, distinct from `database`) ## Edge Usage - **Base URL:** https://cohesivity.ai/edge/postgres - **Recommended auth:** `POST https://cohesivity.ai/edge/session?key=` → `Authorization: Bearer ` - **Fallback auth:** `?key=` query parameter - **Method:** POST with JSON body `{ "query": "SQL", "params": [...] }` - **Response:** `{ "rows": [...], "rowCount": N }` ## Provisioning curl -s -X POST https://cohesivity.ai/api/resources/postgres \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{"region":"apac"}' Accepted regions are documented in the regions block below. No beta grant is required; normal plan, quota, and Neon-region limits still apply. ## Limits - Max query length: 50,000 chars - Max rows returned: 10,000 - One statement per request (v1) - Per-tier concurrent SQL limit, statement timeout, and max compute (see Launch Rate Limits below) - Scale-to-zero after 5 minutes of inactivity; first query after idle pays a brief cold-start cost ## Launch Rate Limits Ephemeral tenants pause as a whole if any authoritative hard cap below is exceeded. Claimed tiers use account-scoped buckets shared across every project owned by the Cohesivity user; OpenAI, AI Gateway, Deepgram, and Exa are fluid-only after tier, rate, and concurrency checks; AI Gateway and Deepgram have no fixed monthly usage bucket for claimed tiers. **Ephemeral** - compute unit seconds: 3600 per ephemeral tenant lifetime before claim or expiry - public transfer bytes: 250 MB per ephemeral tenant lifetime before claim or expiry - written bytes: 250 MB per ephemeral tenant lifetime before claim or expiry - live storage: 100 MB max total - restore gb months: 0.05 per ephemeral tenant lifetime before claim or expiry - requests: 30 per minute **Claimed Free** - live storage: 512 MB max total - requests: 120 per minute - compute unit seconds: 18000 per month - storage gb months: 1 per month - restore gb months: 0.5 per month - public transfer bytes: 5 GB per month - written bytes: 5 GB per month **Claimed Plus** - live storage: 2 GB max total - requests: 600 per minute - compute unit seconds: 90000 per month - storage gb months: 5 per month - restore gb months: 5 per month - public transfer bytes: 25 GB per month - written bytes: 50 GB per month **Claimed Pro** - live storage: 10 GB max total - requests: 3000 per minute - compute unit seconds: 540000 per month - storage gb months: 25 per month - restore gb months: 25 per month - public transfer bytes: 100 GB per month - written bytes: 250 GB per month