Split out session query.

This commit is contained in:
Mike Cao 2023-08-02 14:21:13 -07:00
parent 7b9c29e039
commit 4497951000
9 changed files with 139 additions and 56 deletions

View file

@ -28,8 +28,8 @@ async function relationalQuery(
return rawQuery(
`select ${column} x, count(*) y
from session as x
where x.session_id in (
from session as s
where s.session_id in (
select website_event.session_id
from website_event
join website
@ -38,7 +38,7 @@ async function relationalQuery(
where website.website_id = {{websiteId::uuid}}
and website_event.created_at between {{startDate}} and {{endDate}}
${filterQuery}
)
) as t
group by 1
order by 2 desc
limit 100`,
@ -64,7 +64,7 @@ async function clickhouseQuery(
`
select
${column} x, count(distinct session_id) y
from website_event as x
from website_event
where website_id = {websiteId:UUID}
and created_at between {startDate:DateTime} and {endDate:DateTime}
and event_type = {eventType:UInt32}