helpful-alligator-75316
03/19/2024, 7:33 PMselect
min(timestamp) timestamp,
session_id,
anonymous_id,
host,
countIf(event = 'page_viewed') page_views
from events
group by session_id, anonymous_id, host
having page_views < 2
Turns into this query which has no timestamp or experiment_id filter:
__metric as (-- Metric (Bounce Rate)
SELECT
session_id as session_id,
1 as value,
m.timestamp as timestamp
FROM
( -- This subquery is scanning the entire database (would be nice to limit by experiment_id or timestamp somehow
select
min(timestamp) timestamp,
session_id,
anonymous_id,
host,
countIf(event = 'page_viewed') page_views
from events
group by session_id, anonymous_id, host
having page_views < 2
) m
WHERE m.timestamp >= toDateTime('2024-03-01 16:15:00', 'UTC') AND m.timestamp <= toDateTime('2024-03-19 19:20:50', 'UTC')
)
agreeable-elephant-38605
03/19/2024, 9:21 PMselect
min(timestamp) timestamp,
session_id,
anonymous_id,
host,
countIf(event = 'page_viewed') page_views
from events
where timestamp >= '{{ startDate }}'
AND timestamp < '{{ endDate }}'
group by session_id, anonymous_id, host
having page_views < 2
helpful-alligator-75316
03/19/2024, 9:22 PM