Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore: drop not used daily aggregate view (#64864)

Andy Zhao02fa4f361f21
diff --git a/posthog/clickhouse/migrations/0279_drop_daily_aggregated_query_log_archive_view.py b/posthog/clickhouse/migrations/0279_drop_daily_aggregated_query_log_archive_view.py
new file mode 100644
index 000000000000..5afdb1198c11
--- /dev/null
+++ b/posthog/clickhouse/migrations/0279_drop_daily_aggregated_query_log_archive_view.py
@@ -0,0 +1,10 @@
+from posthog.clickhouse.client.connection import NodeRole
+from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions
+from posthog.clickhouse.query_log_archive import DAILY_AGGREGATED_QUERY_LOG_ARCHIVE_VIEW
+
+operations = [
+ run_sql_with_exceptions(
+ f"DROP VIEW IF EXISTS {DAILY_AGGREGATED_QUERY_LOG_ARCHIVE_VIEW} SYNC",
+ node_roles=[NodeRole.OPS],
+ ),
+]
diff --git a/posthog/clickhouse/migrations/max_migration.txt b/posthog/clickhouse/migrations/max_migration.txt
index b790c6ac2ced..932241badde4 100644
--- a/posthog/clickhouse/migrations/max_migration.txt
+++ b/posthog/clickhouse/migrations/max_migration.txt
@@ -1 +1 @@
-0278_web_stats_paths_preaggregated_pathkey
+0279_drop_daily_aggregated_query_log_archive_view
diff --git a/posthog/clickhouse/schema.py b/posthog/clickhouse/schema.py
index 6ae922472d55..5d6c21e5fffe 100644
--- a/posthog/clickhouse/schema.py
+++ b/posthog/clickhouse/schema.py
@@ -88,7 +88,6 @@ from posthog.clickhouse.property_values import (
PROPERTY_VALUES_TABLE_SQL,
)
from posthog.clickhouse.query_log_archive import (
- DAILY_AGGREGATED_QUERY_LOG_ARCHIVE_VIEW_SQL,
DISTRIBUTED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,
QUERY_LOG_ARCHIVE_BUFFER_OPS_TABLE_SQL,
QUERY_LOG_ARCHIVE_OPS_MV,
@@ -521,7 +520,6 @@ CREATE_VIEW_QUERIES = (
SESSIONS_VIEW_SQL,
RAW_SESSIONS_CREATE_OR_REPLACE_VIEW_SQL,
RAW_SESSIONS_CREATE_OR_REPLACE_VIEW_SQL_V3,
- DAILY_AGGREGATED_QUERY_LOG_ARCHIVE_VIEW_SQL,
)