Skip to content

Commit eb545b1

Browse files
committed
feat: try optimization for clickhouse query
1 parent a0e8b34 commit eb545b1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/cron/postAnalyticsClickhouse.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ export const postAnalyticsClickhouseCron: Cron = {
5858
sum(go_to_link) AS "goToLink"
5959
FROM api.post_analytics
6060
FINAL
61+
WHERE post_id IN (
62+
SELECT DISTINCT post_id
63+
FROM api.post_analytics
64+
WHERE created_at > {lastRunAt: DateTime}
65+
)
6166
GROUP BY id
6267
HAVING "updatedAt" > {lastRunAt: DateTime}
6368
ORDER BY "updatedAt" DESC;

0 commit comments

Comments
 (0)