Run a HogQL query
posthog_queryExecute HogQL queries against PostHog data to analyze events, persons, sessions, groups, and session replays. Filter and aggregate with SQL-like syntax for custom insights.
Instructions
Runs a HogQL (ClickHouse SQL dialect) query: tables events, persons, sessions, groups, raw_session_replay_events. Example: SELECT event, count() FROM events WHERE timestamp > now() - INTERVAL 7 DAY GROUP BY event ORDER BY 2 DESC LIMIT 20.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | HogQL query text | |
| project_id | No | Project id; defaults to POSTHOG_PROJECT_ID |