db_query
Runs SQL on your app's PostgreSQL database, in the preview or on your live site's data. Reading live data runs read-only, with a time limit, and is marked as live.
Query the database · Can change or delete
Run SQL on the project's PostgreSQL 19 (env preview by default, or production: the live site's real data). Reads run directly, on production in a read-only transaction with a 5-second limit, and the result says it is live data. A statement that writes runs on preview after an automatic snapshot; on production it needs the db:production permission and confirm: true, and one that drops, truncates or alters, or updates or deletes without a WHERE clause (or about a thousand rows or more), waits for the owner's approval in the portal first. Prefer migration files (db migrate) for schema changes. Results are capped (max_rows, default 100); values come back as text. For a SELECT use db_read.
For your AI: this page as Markdown · llms.txt