Skip to main content
The Explorer lets you query your project’s raw events with SQL.

When to use the Explorer

  • Ad-hoc analysis for one specific question
  • Custom calculations that are not in standard reports
  • Data validation to check a metric or a new event
  • Debugging event properties after an installation

Run a query

  1. Open your project in the dashboard.
  2. Click Explorer in the left navigation, then Data.
  3. Write a SELECT query over raw_events and click Run query.
The Explorer uses ClickHouse SQL. Every query reads only the current project’s events.

The raw_events table

The sessions table

sessions has one row for each session of the date range: the same sessions as on the Overview. Use it for sessions, bounce rate, session duration and sessions by source. Do not count sessions from raw_events (for example with session_id or time buckets): those numbers do not match the reports.
  • The table follows the date range in the page header (or the last 30 days). Do not add a date condition, and do not use {{date_from}} or {{date_to}} on it.
  • It has no bot traffic.
  • Name only the columns that you need. Each landing column that a query names uses memory, and SELECT * names all of them. A query has 256 MiB. On a project with about 2,000,000 page views and custom events in the date range, a query with one or two landing columns passes. If a query needs more memory, the message tells you to use a shorter date range or fewer landing columns.
  • Other fields of the first page view (device, browser, os, utm_content, utm_term) are not in sessions. Read them from raw_events.
  • A session ID that a client keeps for more than 24 hours is one session of at most 24 hours in sessions. The reports split such an ID by inactivity. The SDKs start a new session ID before that.
  • session_events has one row for each page view and custom event of the same date range (anonymous_id, message_id, type, event, user_id, channel, context, properties, original_timestamp, received_at), with its session_key and session_counted (1 when the session counts). Use it when a query needs the events inside a session. It works out the sessions when the query runs, so it needs more memory than sessions: it passes for about 200,000 events in the date range.
  • You cannot name a CTE sessions, session_events, raw_events or fx_rates_daily.

Example queries

Daily visitors over the last 30 days
Top custom events by plan
Page views by channel

Date range

Use {{date_from}} and {{date_to}} to follow the date range in the page header. They become dates such as '2026-01-31'. Use both or neither. Without a header range, they cover the last 30 days.

Limits

  • Queries are read-only. Write one SELECT or WITH statement without comments.
  • You can read raw_events, sessions, session_events, subqueries and CTEs that you define. Other datasources, system tables, table functions such as url(), s3(), file() and numbers(), and network, dictionary and server functions are refused.
  • SETTINGS, FORMAT and INTO OUTFILE clauses are refused. The Explorer sets them for you.
  • A LIMIT or TOP must be a plain number up to 10,000. LIMIT BY, WITH TIES and FETCH are refused.
  • A result has at most 200 rows and 1 MB.
  • A query stops after 8 seconds or 256 MiB of memory.
  • sessions and session_events use memory for each event in the date range. A range with up to about 200,000 page views and custom events passes; a larger range can stop with a memory error. A query that stops gives an error, never a wrong number. Use a shorter date range, or read raw_events when the query does not need sessions. The reports (Overview, Sources, Pages, User paths) do not have this limit.
  • You can run 10 queries a minute, and a project can run 30 a minute.
  • raw_events includes bot rows. Exclude them with JSONExtractString(context, 'device') != 'bot'.
  • Rows can repeat when a client retries. Use uniqExact(message_id) when you need exact event counts.