From 7b9abd72f85f8fd4acd4f795bd028c59ad3155c3 Mon Sep 17 00:00:00 2001 From: Brian Cao Date: Sun, 5 Mar 2023 13:30:21 -0800 Subject: [PATCH] Limit metrics. --- queries/analytics/pageview/getPageviewMetrics.ts | 6 ++++-- queries/analytics/session/getSessionMetrics.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/queries/analytics/pageview/getPageviewMetrics.ts b/queries/analytics/pageview/getPageviewMetrics.ts index 08221396..0475207c 100644 --- a/queries/analytics/pageview/getPageviewMetrics.ts +++ b/queries/analytics/pageview/getPageviewMetrics.ts @@ -52,7 +52,8 @@ async function relationalQuery( and event_type = $4 ${filterQuery} group by 1 - order by 2 desc`, + order by 2 desc + limit 200`, params, ); } @@ -86,7 +87,8 @@ async function clickhouseQuery( and ${getBetweenDates('created_at', startDate, endDate)} ${filterQuery} group by x - order by y desc`, + order by y desc + limit 200`, params, ); } diff --git a/queries/analytics/session/getSessionMetrics.ts b/queries/analytics/session/getSessionMetrics.ts index 3465967e..9f427e53 100644 --- a/queries/analytics/session/getSessionMetrics.ts +++ b/queries/analytics/session/getSessionMetrics.ts @@ -39,7 +39,8 @@ async function relationalQuery( ${filterQuery} ) group by 1 - order by 2 desc`, + order by 2 desc + limit 200`, params, ); } @@ -63,7 +64,8 @@ async function clickhouseQuery( and ${getBetweenDates('created_at', startDate, endDate)} ${filterQuery} group by x - order by y desc`, + order by y desc + limit 200`, params, ); }