How to Count Sessions in GA4 BigQuery Data
Last updated August 29, 2026 · By the SaturnSQL team
A GA4 session has no row of its own in the export. Count distinct combinations of user_pseudo_id and the ga_session_id event parameter; ga_session_id alone is only unique per user, not globally.
SELECT COUNT(DISTINCT CONCAT(
user_pseudo_id, '-',
CAST((SELECT value.int_value
FROM UNNEST(event_params)
WHERE key = 'ga_session_id') AS STRING)
)) AS sessions
FROM `myproject.analytics_123456789.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20260801' AND '20260828';Sessions per day
SELECT
PARSE_DATE('%Y%m%d', event_date) AS day,
COUNT(DISTINCT CONCAT(
user_pseudo_id, '-',
CAST((SELECT value.int_value
FROM UNNEST(event_params)
WHERE key = 'ga_session_id') AS STRING)
)) AS sessions
FROM `myproject.analytics_123456789.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20260801' AND '20260828'
GROUP BY day
ORDER BY day;Why the concatenation matters
ga_session_id is derived from the timestamp when the session started, so two different users can share the same value. Counting DISTINCT ga_session_id alone undercounts. The user_pseudo_id + ga_session_id pair is the export's real session key. Expect small differences from the GA4 UI's session count, which is estimated rather than counted exactly.
Run this in SaturnSQL
SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.
Try it freeDo more with BigQuery
Related BigQuery guides
- How to Count Distinct Values in BigQuery
- How to Query GA4 Events in BigQuery
- How to Unnest event_params in GA4 BigQuery Data
- How to Calculate Session Duration in GA4 BigQuery Data
- How to Get Session Source and Medium in GA4 BigQuery Data
- How to Count Active Users in GA4 BigQuery Data
- Why GA4 and BigQuery Numbers Don't Match