limit event/session table to 1000 for performance

This commit is contained in:
Francis Cao 2024-08-13 10:49:04 -07:00
parent 7ae53e2650
commit 3805a0b431
2 changed files with 6 additions and 0 deletions

View File

@ -32,6 +32,7 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters, pagePar
return pagedQuery(
`
with events as (
select
event_id as id,
website_id as websiteId,
@ -56,6 +57,8 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters, pagePar
: ''
}
order by created_at desc
limit 1000)
select * from events
`,
{ ...params, query },
pageParams,

View File

@ -29,6 +29,7 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters, pagePar
return pagedQuery(
`
with sessions as (
select
session_id as id,
website_id as websiteId,
@ -51,6 +52,8 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters, pagePar
${filterQuery}
group by session_id, website_id, hostname, browser, os, device, screen, language, country, subdivision1, city
order by lastAt desc
limit 1000)
select * from sessions
`,
params,
pageParams,