querying-production-databases
Skill by PostHog
Runs read-only queries against PostHog's production ClickHouse and Postgres in the US and EU regions. It is for PostHog staff, and it is internal-only because results contain cross-customer data.
Install querying-production-databases
Built from the published package, never by AI.
git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.claude/skills && cp -r /tmp/posthog/.agents/skills/querying-production-databases ~/.claude/skills/querying-production-databasesRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install querying-production-databases in Claude Code
git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/posthog/.agents/skills/querying-production-databases ~/.gemini/antigravity-cli/skills/querying-production-databasesAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install querying-production-databases in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill tells an AI assistant how PostHog staff query production databases. US sources are reached directly through the PostHog MCP on US team 2 using execute-sql with a connectionId. EU sources are reached through a personal PostHog connection from US team 2 to an EU login, using posthog-connection-call. The skill covers the one-time EU connection setup, finding the direct-connect sources, and choosing between raw ClickHouse mode and HogQL mode.
It also includes rules and query patterns for query_log_archive, system tables, per-team events and app tables. The source says it is the default path before the Metabase skill, which covers Postgres query plans, the test cluster and shareable links. It is written for internal PostHog staff only.
Written from the project's SKILL.md and checked against it.
What it can do
- execute-sqlRuns a read-only SELECT against a direct-connect SQL source in US team 2.
- posthog-connection-callRuns execute-sql and other tools in the EU project through a personal PostHog connection.
- integrations-listFinds the id of your personal PostHog connection.
- external-data-sources-connections-listLists SQL sources so you can pick the right ClickHouse or Postgres source.
- switch-projectMoves the MCP session to US team 2 when it starts in another project.
- Raw ClickHouse modeSends SQL as written, using sendRawQuery true, for ClickHouse sources.
- Query patternsIncludes checked queries for slow queries, per-team cost, query_id lookup and cluster state.
What you need
- PostHog MCP access to US cloud
- Access to US team 2
- An EU PostHog login for EU sources
- A personal PostHog connection with the POSTHOG_CONNECT feature flag
Try asking
- Show the slowest queries in query_log_archive for the last hour
- Find the direct-connect sources in the EU project
- Count events per team for one day in the production ClickHouse
Good to know
- Read-only. Only one SELECT per call is allowed.
- Internal-only. Results contain cross-customer data.
- Raw mode has no automatic row limit. ClickHouse returns up to 1,000,000 rows before it fails.
- A personal PostHog connection works only for the person who created it.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/querying-production-databases/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md10 KB -
references/query-patterns.md4 KB
Alternatives to querying-production-databases
All alternatives →Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.
Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.
Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.
Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.
Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.
Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.
Compare with hugging-face-datasets, db-repair or alloydb-basics
querying-production-databases: common questions
Does this skill work with EU PostHog data?
Yes. EU sources are queried through a personal PostHog connection from US team 2 to an EU login, using posthog-connection-call. The source says EU data must stay in EU and must not be copied into US projects or notebooks.
When should I use Metabase instead?
The source says to use the Metabase skill for Postgres query plans, the test cluster, shareable Metabase links, and tables that no source exposes.
Why does my EU connection fail with a scope error?
The source says the connection was probably created with broader scopes than the MCP token. It recommends deleting it and connecting again with only query read, external_data_source read and user read.
How do I install querying-production-databases?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is querying-production-databases free?
The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.
Is querying-production-databases safe to use?
It scores 84 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to querying-production-databases?
Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.
