Skip to content

Commit

Permalink
replace count(distinct with uniq for session / visits
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscao633 committed Jul 1, 2024
1 parent bfe494f commit 20b3a3e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/queries/analytics/getWebsiteStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ async function clickhouseQuery(
`
select
sum(t.c) as "pageviews",
count(distinct t.session_id) as "visitors",
count(distinct t.visit_id) as "visits",
uniq(t.session_id) as "visitors",
uniq(t.visit_id) as "visits",
sum(if(t.c = 1, 1, 0)) as "bounces",
sum(max_time-min_time) as "totaltime"
from (
Expand Down
2 changes: 1 addition & 1 deletion src/queries/analytics/sessions/getSessionMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async function clickhouseQuery(
`
select
${column} x,
count(distinct session_id) y
uniq(session_id) y
${includeCountry ? ', country' : ''}
from website_event
where website_id = {websiteId:UUID}
Expand Down

0 comments on commit 20b3a3e

Please sign in to comment.