On near-empty test databases the planner misestimates some queries so badly that they exceed `jit_above_cost`, and Postgres then LLVM-compiles them on every call. For `GetUserStatusCounts` that is about 275ms of a 290ms execution (`EXPLAIN (ANALYZE)` on an empty database estimates 5.7M rows for the `dates_of_interest x relevant_status_changes` nested loop; actual rows: 61). Multiplied by the 925 leaves of `TestGetUserStatusCounts`, that single test was 85% of the `coderd/database` package time. JIT is an execution optimization with no semantic effect, so `dbtestutil.NewDB` now runs `ALTER DATABASE <db> SET jit = off` on each per-test database, next to the existing timezone setting. Database-level settings are not copied by `CREATE DATABASE ... TEMPLATE`, so this has to run per clone, which is where the timezone statement already runs; the `CODER_PG_CONNECTION_URL` path goes through the same function. ## Before / After Local, `go test -count=1 -tags=testsmallbatch -parallel=8` (shared host, load about 50): | | Before | After | |---|---|---| | `./coderd/database/ -run '^TestGetUserStatusCounts$'` | `ok 63.2s` | `ok 6.4s` | | `./coderd/database/` | `ok 57.2s` | `ok 10.0s` | | `./coderd/database/dbauthz/` | `ok 7.4s` / `14.0s` | `ok 10.3s` / `7.6s` (noise) | | `./coderd/database/dbpurge/` | `ok 4.1s` | `ok 3.8s` | | `./coderd/httpmw/` | `ok 1.3s` | `ok 1.0s` | Only `coderd/database` (172s in the baseline CI job) is expected to move materially; the other packages are listed to show no regression. ## Validation - The five runs above pass; `TestGetUserStatusCounts` still runs its 925 subtests - `golangci-lint run ./coderd/database/dbtestutil/...` with a fresh cache: 0 issues - Repository pre-commit hook passed on the commit Production note, not addressed here: with `jit=on` (the default in the pgdg builds) production pays the same per-call compilation for `GetUserStatusCounts`; the query shape (`generate_series` cross join with no statistics on the CTE) deserves its own fix. Part of the test-suite speedup series (see #29457). Independent of the other PRs; #29464 (fixture sharing in the same test) composes with it. ## Remote validation Remote run on a dogfood workspace (separate compute), chat https://dogfood.cdr.dev/agents/5bbe73d0-866a-4841-9cc3-c5e5b4d97e44, tested head `353879f5d12` against base `9d973372774` on the same machine (its base time, 56.4s for the package, matches the table above): `./coderd/database/ -run '^TestGetUserStatusCounts$'` 46.97s to 13.81s (925 subtests pass on both); `./coderd/database/` 56.43s to 20.49s (32.48s on a first run); `dbauthz`, `dbpurge`, `httpmw` unchanged; `-race -count=2 -shuffle=on`: pass. A live `pg_db_role_setting` query during a test run showed `{TimeZone=...,jit=off}` on every per-test database and nothing on the `tpl_` template, as intended. The standalone speedup there is 3.4x for the test and about 2x for the package, less than the 10x and 5.7x in the table above, which came from a single run on the development host: on the dogfood host the per-test database clone dominates once JIT is off. The headline numbers (test 0.6s, package 7.5s) are reached together with #29464, which removes the per-leaf clone. Endorsed verdict: PASS on behavior; the table above overstates the standalone gain. > Xum (an AI agent) authored this PR on behalf of @ibetitsmike.
Coder is a self-hosted platform for cloud development environments and AI coding agents. Workspaces are defined with Terraform, connected through a secure Wireguard® tunnel, and automatically shut down when not used. Coder Agents runs a native AI coding agent whose loop executes in the control plane on your infrastructure, with no API keys in workspaces.
- Define cloud development environments in Terraform
- EC2 VMs, Kubernetes Pods, Docker Containers, etc.
- Automatically shutdown idle resources to save on costs
- Onboard developers in seconds instead of days
- Delegate coding work to AI agents on your infrastructure
- Bring any model (Anthropic, OpenAI, Google, Bedrock, self-hosted)
- No LLM credentials in workspaces, user identity on every action
- Centralized model governance, cost tracking, and audit logging
Quickstart
Check out our install guides for other methods and a complete tutorial.
Try Coder with the install script on Linux and macOS, or grab the latest binary or installer from GitHub Releases on Windows:
curl -L https://coder.com/install.sh | sh
Start the server and open http://localhost:3000 to create your initial user, create a Docker template, and provision your first workspace:
coder server
For a production deployment, add a PostgreSQL database (version 13 or later) and an external access URL, and see our validated architectures for sizing and infrastructure guidance:
coder server --postgres-url <url> --access-url <url>
Without these flags, Coder uses a built-in database and sets up a *.try.coder.app access URL for evaluation. Use coder --help for the full list of flags and environment variables.
Documentation
Browse the documentation or visit a specific section below:
- Workspaces: Workspaces contain the IDEs, dependencies, and configuration information needed for software development
- Templates: Templates are written in Terraform and describe the infrastructure for workspaces
- Coder Agents: Delegate coding work to AI agents running on your self-hosted infrastructure
- AI Gateway: Centralize authentication, auditing, and cost controls for AI tooling
- Administration: Learn how to operate Coder
- Premium: Learn about paid features built for large teams
- IDEs: Connect your existing editor to a workspace
Support
Open an issue for bugs and feature requests.
For community support, showcasing what you built, and feedback on in-progress features, join our Discord or GitHub Discussions.
Dedicated support is included in Coder Premium. For more information, visit coder.com/pricing.
Integrations
New integrations are always in progress. Open an issue to request one. Contributions are welcome in any official or community repository.
Official
- Coder Registry: Templates, modules, and integrations for common development environments
- Coding Agents: Run agents like Claude Code, Codex, and OpenCode isolated in Coder workspaces
- coderd Terraform Provider: Declaratively manage your Coder deployment configuration as code
- VS Code Extension: Open any Coder workspace in VS Code with a single click
- JetBrains Toolbox Plugin: Open any Coder workspace from JetBrains Toolbox with a single click
- Dev Containers: Build development environments using
devcontainer.jsonon Docker, Kubernetes, and OpenShift - Kubernetes Log Stream: Stream Kubernetes Pod events to the Coder startup logs
- Self-Hosted VS Code Extension Marketplace: A private extension marketplace that works in restricted or airgapped networks integrating with code-server.
- GitHub Actions: An action to set up the Coder CLI in GitHub workflows
Community
- Coder Discord: Chat with the community, get support, and hear about new product updates first
- Community Templates: Community-contributed workspace templates in the Coder Registry
- Community Modules: Community-contributed modules to extend Coder templates
- Coder Template GitHub Action: A GitHub Action that updates Coder templates
- Coder Agents Chat Action: A GitHub Action that starts a Coder Agents chat against a GitHub issue or pull request
Contributing
New contributors are always welcome. If you are new to the Coder codebase, see the contribution guide to get started.
Hiring
Apply on the careers page if you are interested in joining the team.
