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
- Open your project in the dashboard.
- Click Explorer in the left navigation, then Data.
- Write a
SELECTquery overraw_eventsand click Run query.
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 insessions. Read them fromraw_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_eventshas 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 itssession_keyandsession_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 thansessions: it passes for about 200,000 events in the date range.- You cannot name a CTE
sessions,session_events,raw_eventsorfx_rates_daily.
Example queries
Daily visitors over the last 30 daysDate 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
SELECTorWITHstatement without comments. - You can read
raw_events,sessions,session_events, subqueries and CTEs that you define. Other datasources,systemtables, table functions such asurl(),s3(),file()andnumbers(), and network, dictionary and server functions are refused. SETTINGS,FORMATandINTO OUTFILEclauses are refused. The Explorer sets them for you.- A
LIMITorTOPmust be a plain number up to 10,000.LIMIT BY,WITH TIESandFETCHare refused. - A result has at most 200 rows and 1 MB.
- A query stops after 8 seconds or 256 MiB of memory.
sessionsandsession_eventsuse 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 readraw_eventswhen 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_eventsincludes bot rows. Exclude them withJSONExtractString(context, 'device') != 'bot'.- Rows can repeat when a client retries. Use
uniqExact(message_id)when you need exact event counts.