: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(clickhouse): remove the retired query_log_archive generations (#120883)
Rory Shanks40fc29e3f8d4
diff --git a/posthog/clickhouse/hcl/golden/dev/ai_events.hcl b/posthog/clickhouse/hcl/golden/dev/ai_events.hclindex aa306cfe8cfc..0f50d9e05606 100644--- a/posthog/clickhouse/hcl/golden/dev/ai_events.hcl+++ b/posthog/clickhouse/hcl/golden/dev/ai_events.hcl@@ -739,496 +739,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -1839,140 +1349,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/dev/apm.hcl b/posthog/clickhouse/hcl/golden/dev/apm.hclindex 76182ce9d431..f2d2edb86641 100644--- a/posthog/clickhouse/hcl/golden/dev/apm.hcl+++ b/posthog/clickhouse/hcl/golden/dev/apm.hcl@@ -849,107 +849,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -2146,140 +2045,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/dev/auxiliary.hcl b/posthog/clickhouse/hcl/golden/dev/auxiliary.hclindex eff8369f72c0..0416f21366b5 100644--- a/posthog/clickhouse/hcl/golden/dev/auxiliary.hcl+++ b/posthog/clickhouse/hcl/golden/dev/auxiliary.hcl@@ -2122,395 +2122,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "raw_error_tracking_fingerprint_issue_state" {order_by = ["team_id", "fingerprint"]settings = {@@ -5240,107 +4851,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -5932,140 +5442,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/dev/batch_exports.hcl b/posthog/clickhouse/hcl/golden/dev/batch_exports.hclindex 6341d310dfe8..562ef65bcc6d 100644--- a/posthog/clickhouse/hcl/golden/dev/batch_exports.hcl+++ b/posthog/clickhouse/hcl/golden/dev/batch_exports.hcl@@ -388,395 +388,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "sharded_events_recent" {order_by = ["team_id", "toStartOfHour(inserted_at)", "event", "cityHash64(distinct_id)", "cityHash64(uuid)"]partition_by = "toStartOfDay(inserted_at)"@@ -870,107 +481,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -1327,140 +837,6 @@ database "posthog" {}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/dev/data.hcl b/posthog/clickhouse/hcl/golden/dev/data.hclindex a7a331298d8c..753e88e51aac 100644--- a/posthog/clickhouse/hcl/golden/dev/data.hcl+++ b/posthog/clickhouse/hcl/golden/dev/data.hcl@@ -3749,395 +3749,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "raw_sessions" {column "team_id" {type = "Int64"@@ -8733,107 +8344,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -9928,140 +9438,6 @@ database "posthog" {}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/dev/logs.hcl b/posthog/clickhouse/hcl/golden/dev/logs.hclindex 84efeeeae0ee..98cddbef236e 100644--- a/posthog/clickhouse/hcl/golden/dev/logs.hcl+++ b/posthog/clickhouse/hcl/golden/dev/logs.hcl@@ -2656,395 +2656,6 @@ SQL}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "trace_attributes" {order_by = ["team_id", "attribute_type", "time_bucket", "resource_fingerprint", "attribute_key", "attribute_value"]partition_by = "toDate(original_expiry_time_bucket)"@@ -3560,107 +3171,6 @@ SQL}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -4395,140 +3905,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/dev/ops.hcl b/posthog/clickhouse/hcl/golden/dev/ops.hclindex f0a3cb1e2665..78cb6f9efd73 100644--- a/posthog/clickhouse/hcl/golden/dev/ops.hcl+++ b/posthog/clickhouse/hcl/golden/dev/ops.hcl@@ -824,114 +824,7 @@ SQL}}- table "query_log_archive_buffer" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "buffer" {- database = "posthog"- table = "sharded_query_log_archive"- num_layers = 16- min_time = 10- max_time = 60- min_rows = 10000- max_rows = 1000000- min_bytes = 10000000- max_bytes = 100000000- }- }-- table "query_log_archive_v3" {+ table "query_log_archive_v3_buffer" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"}@@ -1227,829 +1120,69 @@ SQLtype = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-- table "query_log_archive_v3_buffer" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- engine "buffer" {- database = "posthog"- table = "sharded_query_log_archive_v3"- num_layers = 16- min_time = 10- max_time = 60- min_rows = 10000- max_rows = 1000000- min_bytes = 10000000- max_bytes = 100000000- }- }-- table "sharded_query_log_archive" {- order_by = ["team_id", "event_date", "event_time", "query_id"]- partition_by = "toYYYYMM(event_date)"- settings = {- index_granularity = "8192"- object_serialization_version = "v3"- object_shared_data_serialization_version = "map_with_buckets"- storage_policy = "s3_tiered"- }- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- column "exception_name" {- type = "String"- alias = "errorCodeToName(exception_code)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "Int64"- alias = "ProfileEvents['RealTimeMicroseconds']"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "Int64"- alias = "ProfileEvents['OSCPUVirtualTimeMicroseconds']"- }- column "ProfileEvents_S3Clients" {- type = "Int64"- alias = "ProfileEvents['S3Clients']"- }- column "ProfileEvents_S3DeleteObjects" {- type = "Int64"- alias = "ProfileEvents['S3DeleteObjects']"- }- column "ProfileEvents_S3CopyObject" {- type = "Int64"- alias = "ProfileEvents['S3CopyObject']"- }- column "ProfileEvents_S3ListObjects" {- type = "Int64"- alias = "ProfileEvents['S3ListObjects']"- }- column "ProfileEvents_S3HeadObject" {- type = "Int64"- alias = "ProfileEvents['S3HeadObject']"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "Int64"- alias = "ProfileEvents['S3GetObjectAttributes']"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3CreateMultipartUpload']"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "Int64"- alias = "ProfileEvents['S3UploadPartCopy']"- }- column "ProfileEvents_S3UploadPart" {- type = "Int64"- alias = "ProfileEvents['S3UploadPart']"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3AbortMultipartUpload']"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3CompleteMultipartUpload']"- }- column "ProfileEvents_S3PutObject" {- type = "Int64"- alias = "ProfileEvents['S3PutObject']"- }- column "ProfileEvents_S3GetObject" {- type = "Int64"- alias = "ProfileEvents['S3GetObject']"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "Int64"- alias = "ProfileEvents['ReadBufferFromS3Bytes']"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "Int64"- alias = "ProfileEvents['WriteBufferFromS3Bytes']"- }- column "lc_workflow" {- type = "LowCardinality(String)"- alias = "log_comment.workflow"- }- column "lc_kind" {- type = "LowCardinality(String)"- alias = "log_comment.kind"- }- column "lc_id" {- type = "String"- alias = "CAST(log_comment.id, 'String')"- }- column "lc_route_id" {- type = "String"- alias = "CAST(log_comment.route_id, 'String')"- }- column "lc_access_method" {- type = "LowCardinality(String)"- alias = "log_comment.access_method"- }- column "lc_api_key_label" {- type = "String"- alias = "CAST(log_comment.api_key_label, 'String')"- }- column "lc_api_key_mask" {- type = "String"- alias = "CAST(log_comment.api_key_mask, 'String')"- }- column "lc_query_type" {- type = "LowCardinality(String)"- alias = "log_comment.query_type"- }- column "lc_product" {- type = "LowCardinality(String)"- alias = "log_comment.product"- }- column "lc_chargeable" {- type = "Bool"- alias = "log_comment.chargeable"- }- column "lc_name" {- type = "String"- alias = "CAST(log_comment.name, 'String')"- }- column "lc_request_name" {- type = "String"- alias = "CAST(log_comment.request_name, 'String')"- }- column "lc_client_query_id" {- type = "String"- alias = "CAST(log_comment.client_query_id, 'String')"- }- column "lc_org_id" {- type = "String"- alias = "CAST(log_comment.org_id, 'String')"- }- column "lc_user_id" {- type = "Int64"- alias = "log_comment.user_id"- }- column "lc_is_impersonated" {- type = "Bool"- alias = "log_comment.is_impersonated"- }- column "lc_session_id" {- type = "String"- alias = "CAST(log_comment.session_id, 'String')"- }- column "lc_dashboard_id" {- type = "Int64"- alias = "log_comment.dashboard_id"- }- column "lc_insight_id" {- type = "Int64"- alias = "log_comment.insight_id"- }- column "lc_cohort_id" {- type = "Int64"- alias = "log_comment.cohort_id"- }- column "lc_batch_export_id" {- type = "String"- alias = "CAST(log_comment.batch_export_id, 'String')"- }- column "lc_experiment_id" {- type = "Int64"- alias = "log_comment.experiment_id"- }- column "lc_experiment_feature_flag_key" {- type = "String"- alias = "CAST(log_comment.experiment_feature_flag_key, 'String')"- }- column "lc_alert_config_id" {- type = "String"- alias = "CAST(log_comment.alert_config_id, 'String')"- }- column "lc_feature" {- type = "LowCardinality(String)"- alias = "log_comment.feature"- }- column "lc_table_id" {- type = "String"- alias = "CAST(log_comment.table_id, 'String')"- }- column "lc_warehouse_query" {- type = "Bool"- alias = "log_comment.warehouse_query"- }- column "lc_person_on_events_mode" {- type = "LowCardinality(String)"- alias = "log_comment.person_on_events_mode"- }- column "lc_service_name" {- type = "String"- alias = "CAST(log_comment.service_name, 'String')"- }- column "lc_workload" {- type = "LowCardinality(String)"- alias = "log_comment.workload"+ type = "SimpleAggregateFunction(max, String)"}- column "lc_query__kind" {- type = "LowCardinality(String)"- alias = "if(JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'kind'), JSONExtractString(toString(log_comment), 'query', 'kind'))"+ column "lc_experiment_metric_name" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_query__query" {- type = "String"- alias = "multiIf(NOT is_initial_query, '', JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'), JSONExtractString(toString(log_comment), 'query', 'query'))"+ column "lc_experiment_execution_path" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_query" {- type = "String"- alias = "if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), '')"+ column "lc_experiment_metric_type" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_temporal__workflow_namespace" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_namespace`, 'String')"+ column "lc_experiment_funnel_order_type" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_temporal__workflow_type" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_type`, 'String')"+ column "lc_experiment_exposures_path" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_temporal__workflow_id" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_id`, 'String')"+ column "lc_experiment_metric_events_path" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_temporal__workflow_run_id" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_run_id`, 'String')"+ column "lc_experiment_query_surface" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_temporal__activity_type" {- type = "String"- alias = "CAST(log_comment.`temporal.activity_type`, 'String')"+ column "lc_experiment_precompute_table" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_temporal__activity_id" {- type = "String"- alias = "CAST(log_comment.`temporal.activity_id`, 'String')"+ column "lc_experiment_query_group_id" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_temporal__attempt" {- type = "Int64"- alias = "log_comment.`temporal.attempt`"+ column "lc_experiment_precompute_skip_reason" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_dagster__job_name" {- type = "String"- alias = "CAST(log_comment.`dagster.job_name`, 'String')"+ column "lc_experiment_scan_date_from" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_dagster__run_id" {- type = "String"- alias = "CAST(log_comment.`dagster.run_id`, 'String')"+ column "lc_experiment_scan_date_to" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_dagster__owner" {- type = "String"- alias = "CAST(log_comment.`dagster.tags.owner`, 'String')"+ column "lc_precompute_window_start" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_modifiers" {- type = "String"- alias = "if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), '')"+ column "lc_precompute_window_end" {+ type = "SimpleAggregateFunction(max, String)"}column "lc_plan_fingerprint" {- type = "String"- alias = "ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), '')"+ type = "SimpleAggregateFunction(max, String)"}column "lc_estimated_rows" {- type = "Int64"- alias = "ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0)"+ type = "SimpleAggregateFunction(max, Int64)"}column "lc_estimated_bytes" {- type = "Int64"- alias = "ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0)"- }- column "ProfileEvents2" {- type = "JSON(max_dynamic_paths=0, OSCPUVirtualTimeMicroseconds UInt64, ReadBufferFromS3Bytes UInt64, RealTimeMicroseconds UInt64, S3AbortMultipartUpload UInt64, S3Clients UInt64, S3CompleteMultipartUpload UInt64, S3CopyObject UInt64, S3CreateMultipartUpload UInt64, S3DeleteObjects UInt64, S3GetObject UInt64, S3GetObjectAttributes UInt64, S3HeadObject UInt64, S3ListObjects UInt64, S3PutObject UInt64, S3UploadPart UInt64, S3UploadPartCopy UInt64, WriteBufferFromS3Bytes UInt64)"+ type = "SimpleAggregateFunction(max, Int64)"}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.sharded_query_log_archive"- replica_name = "{replica}-{shard}"+ engine "buffer" {+ database = "posthog"+ table = "sharded_query_log_archive_v3"+ num_layers = 16+ min_time = 10+ max_time = 60+ min_rows = 10000+ max_rows = 1000000+ min_bytes = 10000000+ max_bytes = 100000000}}@@ -2689,107 +1822,6 @@ SQL}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -3176,140 +2208,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/dev/sessions.hcl b/posthog/clickhouse/hcl/golden/dev/sessions.hclindex 5faac100e899..7e1fe6893464 100644--- a/posthog/clickhouse/hcl/golden/dev/sessions.hcl+++ b/posthog/clickhouse/hcl/golden/dev/sessions.hcl@@ -728,395 +728,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "raw_sessions" {order_by = ["team_id", "toStartOfHour(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(session_id_v7, 80)), 1000)))", "cityHash64(session_id_v7)", "session_id_v7"]partition_by = "toYYYYMM(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(session_id_v7, 80)), 1000)))"@@ -1586,107 +1197,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -2043,140 +1553,6 @@ database "posthog" {}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/local-multi/ai_events.hcl b/posthog/clickhouse/hcl/golden/local-multi/ai_events.hclindex 1cb55ef131ae..dad571a6e2b5 100644--- a/posthog/clickhouse/hcl/golden/local-multi/ai_events.hcl+++ b/posthog/clickhouse/hcl/golden/local-multi/ai_events.hcl@@ -679,395 +679,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "sharded_ai_events" {order_by = ["team_id", "trace_id", "timestamp"]partition_by = "toYYYYMM(drop_date)"@@ -1314,107 +925,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -2025,140 +1535,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/local-multi/auxiliary.hcl b/posthog/clickhouse/hcl/golden/local-multi/auxiliary.hclindex f0aaa7c91fe5..10e438eb3e01 100644--- a/posthog/clickhouse/hcl/golden/local-multi/auxiliary.hcl+++ b/posthog/clickhouse/hcl/golden/local-multi/auxiliary.hcl@@ -2165,395 +2165,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "raw_error_tracking_fingerprint_issue_state" {order_by = ["team_id", "fingerprint"]settings = {@@ -5247,107 +4858,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -6008,140 +5518,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/local-multi/data.hcl b/posthog/clickhouse/hcl/golden/local-multi/data.hclindex a0e49b7439dd..103c85e478fa 100644--- a/posthog/clickhouse/hcl/golden/local-multi/data.hcl+++ b/posthog/clickhouse/hcl/golden/local-multi/data.hcl@@ -4099,693 +4099,689 @@ database "posthog" {}}- table "query_log_archive_v2" {- order_by = ["team_id", "event_date", "event_time", "query_id"]- partition_by = "toYYYYMM(event_date)"- settings = {- index_granularity = "8192"+ table "raw_sessions" {+ column "team_id" {+ type = "Int64"}- column "hostname" {- type = "LowCardinality(String)"+ column "session_id_v7" {+ type = "UInt128"}- column "user" {- type = "LowCardinality(String)"+ column "distinct_id" {+ type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"}- column "query_id" {- type = "String"+ column "min_timestamp" {+ type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"}- column "initial_query_id" {- type = "String"+ column "max_timestamp" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "is_initial_query" {- type = "UInt8"+ column "max_inserted_at" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"+ column "urls" {+ type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"}- column "event_date" {- type = "Date"+ column "entry_url" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "event_time" {- type = "DateTime"+ column "end_url" {+ type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"}- column "event_time_microseconds" {- type = "DateTime64(6)"+ column "last_external_click_url" {+ type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"}- column "query_start_time" {- type = "DateTime"+ column "initial_browser" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "query_start_time_microseconds" {- type = "DateTime64(6)"+ column "initial_browser_version" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "query_duration_ms" {- type = "UInt64"+ column "initial_os" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "read_rows" {- type = "UInt64"+ column "initial_os_version" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "read_bytes" {- type = "UInt64"+ column "initial_device_type" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "written_rows" {- type = "UInt64"+ column "initial_viewport_width" {+ type = "AggregateFunction(argMin, Int64, DateTime64(6, 'UTC'))"}- column "written_bytes" {- type = "UInt64"+ column "initial_viewport_height" {+ type = "AggregateFunction(argMin, Int64, DateTime64(6, 'UTC'))"}- column "result_rows" {- type = "UInt64"+ column "initial_geoip_country_code" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "result_bytes" {- type = "UInt64"+ column "initial_geoip_subdivision_1_code" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "memory_usage" {- type = "UInt64"+ column "initial_geoip_subdivision_1_name" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "peak_threads_usage" {- type = "UInt64"+ column "initial_geoip_subdivision_city_name" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "current_database" {- type = "LowCardinality(String)"+ column "initial_geoip_time_zone" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "query" {- type = "String"+ column "initial_referring_domain" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "formatted_query" {- type = "String"+ column "initial_utm_source" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "normalized_query_hash" {- type = "UInt64"+ column "initial_utm_campaign" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "query_kind" {- type = "LowCardinality(String)"+ column "initial_utm_medium" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "exception_code" {- type = "Int32"+ column "initial_utm_term" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "exception_name" {- type = "String"- alias = "errorCodeToName(exception_code)"+ column "initial_utm_content" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "exception" {- type = "String"+ column "initial_gclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "stack_trace" {- type = "String"+ column "initial_gad_source" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_RealTimeMicroseconds" {- type = "Int64"+ column "initial_gclsrc" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "Int64"+ column "initial_dclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3Clients" {- type = "Int64"+ column "initial_gbraid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3DeleteObjects" {- type = "Int64"+ column "initial_wbraid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3CopyObject" {- type = "Int64"+ column "initial_fbclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3ListObjects" {- type = "Int64"+ column "initial_msclkid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3HeadObject" {- type = "Int64"+ column "initial_twclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3GetObjectAttributes" {- type = "Int64"+ column "initial_li_fat_id" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3CreateMultipartUpload" {- type = "Int64"+ column "initial_mc_cid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3UploadPartCopy" {- type = "Int64"+ column "initial_igshid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3UploadPart" {- type = "Int64"+ column "initial_ttclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3AbortMultipartUpload" {- type = "Int64"+ column "initial_epik" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "Int64"+ column "initial_qclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3PutObject" {- type = "Int64"+ column "initial_sccid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3GetObject" {- type = "Int64"+ column "initial__kx" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "Int64"+ column "initial_irclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "Int64"+ column "pageview_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents" {- type = "Map(String, UInt64)"+ column "pageview_uniq" {+ type = "AggregateFunction(uniq, Nullable(UUID))"}- column "lc_workflow" {- type = "LowCardinality(String)"+ column "autocapture_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_kind" {- type = "LowCardinality(String)"+ column "autocapture_uniq" {+ type = "AggregateFunction(uniq, Nullable(UUID))"}- column "lc_id" {- type = "String"+ column "screen_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_route_id" {- type = "String"+ column "screen_uniq" {+ type = "AggregateFunction(uniq, Nullable(UUID))"}- column "lc_access_method" {- type = "LowCardinality(String)"+ column "maybe_has_session_replay" {+ type = "SimpleAggregateFunction(max, Bool)"}- column "lc_api_key_label" {- type = "String"+ column "page_screen_autocapture_uniq_up_to" {+ type = "AggregateFunction(uniqUpTo(1), Nullable(UUID))"}- column "lc_api_key_mask" {- type = "String"+ column "vitals_lcp" {+ type = "AggregateFunction(argMin, Nullable(Float64), DateTime64(6, 'UTC'))"}- column "lc_query_type" {- type = "LowCardinality(String)"+ engine "distributed" {+ cluster_name = "posthog"+ remote_database = "posthog"+ remote_table = "sharded_raw_sessions"+ sharding_key = "cityHash64(session_id_v7)"}- column "lc_product" {- type = "LowCardinality(String)"+ }++ table "raw_sessions_v3" {+ column "team_id" {+ type = "Int64"}- column "lc_chargeable" {- type = "Bool"+ column "session_id_v7" {+ type = "UInt128"}- column "lc_name" {- type = "String"+ column "session_timestamp" {+ type = "DateTime64(3)"+ materialized = "fromUnixTimestamp64Milli(toUInt64(bitShiftRight(session_id_v7, 80)))"}- column "lc_request_name" {- type = "String"+ column "distinct_id" {+ type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"}- column "lc_client_query_id" {- type = "String"+ column "distinct_ids" {+ type = "AggregateFunction(groupUniqArray, String)"}- column "lc_org_id" {- type = "String"+ column "min_timestamp" {+ type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"}- column "team_id" {- type = "Int64"+ column "max_timestamp" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "lc_user_id" {- type = "Int64"+ column "max_inserted_at" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "lc_is_impersonated" {- type = "Bool"+ column "urls" {+ type = "SimpleAggregateFunction(groupUniqArrayArray(2000), Array(String))"}- column "lc_session_id" {- type = "String"+ column "entry_url" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_dashboard_id" {- type = "Int64"+ column "end_url" {+ type = "AggregateFunction(argMax, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_insight_id" {- type = "Int64"+ column "last_external_click_url" {+ type = "AggregateFunction(argMax, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_cohort_id" {- type = "Int64"+ column "browser" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_batch_export_id" {- type = "String"+ column "browser_version" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_experiment_id" {- type = "Int64"+ column "os" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_experiment_feature_flag_key" {- type = "String"+ column "os_version" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_alert_config_id" {- type = "String"+ column "device_type" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_feature" {- type = "LowCardinality(String)"+ column "viewport_width" {+ type = "AggregateFunction(argMin, Nullable(Int64), DateTime64(6, 'UTC'))"}- column "lc_table_id" {- type = "String"+ column "viewport_height" {+ type = "AggregateFunction(argMin, Nullable(Int64), DateTime64(6, 'UTC'))"}- column "lc_warehouse_query" {- type = "Bool"+ column "geoip_country_code" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_person_on_events_mode" {- type = "LowCardinality(String)"+ column "geoip_subdivision_1_code" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_service_name" {- type = "String"+ column "geoip_subdivision_1_name" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_workload" {- type = "LowCardinality(String)"+ column "geoip_subdivision_city_name" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_query__kind" {- type = "LowCardinality(String)"+ column "geoip_time_zone" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_query__query" {- type = "String"+ column "entry_referring_domain" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_query" {- type = "String"+ column "entry_utm_source" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_temporal__workflow_namespace" {- type = "String"+ column "entry_utm_campaign" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_temporal__workflow_type" {- type = "String"+ column "entry_utm_medium" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_temporal__workflow_id" {- type = "String"+ column "entry_utm_term" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_temporal__workflow_run_id" {- type = "String"+ column "entry_utm_content" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_temporal__activity_type" {- type = "String"+ column "entry_gclid" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_temporal__activity_id" {- type = "String"+ column "entry_gad_source" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_temporal__attempt" {- type = "Int64"+ column "entry_fbclid" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_dagster__job_name" {- type = "String"+ column "entry_has_gclid" {+ type = "AggregateFunction(argMin, Bool, DateTime64(6, 'UTC'))"}- column "lc_dagster__run_id" {- type = "String"+ column "entry_has_fbclid" {+ type = "AggregateFunction(argMin, Bool, DateTime64(6, 'UTC'))"}- column "lc_dagster__owner" {- type = "String"+ column "entry_ad_ids_map" {+ type = "AggregateFunction(argMin, Map(String, String), DateTime64(6, 'UTC'))"}- column "lc_modifiers" {- type = "String"+ column "entry_ad_ids_set" {+ type = "AggregateFunction(argMin, Array(String), DateTime64(6, 'UTC'))"}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.query_log_archive_new"- replica_name = "{replica}-{shard}"+ column "entry_channel_type_properties" {+ type = "AggregateFunction(argMin, Tuple(Nullable(String), Nullable(String), Nullable(String), Nullable(String), Bool, Bool, Nullable(String)), DateTime64(6, 'UTC'))"}- }-- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"+ column "pageview_uniq" {+ type = "AggregateFunction(uniqExact, Nullable(UUID))"}- column "team_id" {- type = "Int64"+ column "autocapture_uniq" {+ type = "AggregateFunction(uniqExact, Nullable(UUID))"}- column "initial_query_id" {- type = "String"+ column "screen_uniq" {+ type = "AggregateFunction(uniqExact, Nullable(UUID))"}- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"+ column "page_screen_uniq_up_to" {+ type = "AggregateFunction(uniqUpTo(1), Nullable(UUID))"}- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "has_autocapture" {+ type = "SimpleAggregateFunction(max, Bool)"}- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "flag_key_values" {+ type = "SimpleAggregateFunction(groupUniqArrayArray(10000), Array(String))"}- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"+ column "flag_keys" {+ type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"}- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"+ column "event_names" {+ type = "SimpleAggregateFunction(groupUniqArrayArray(2000), Array(String))"}- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"+ column "hosts" {+ type = "SimpleAggregateFunction(groupUniqArrayArray(100), Array(String))"}- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "emails" {+ type = "SimpleAggregateFunction(groupUniqArrayArray(10), Array(String))"}- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "has_replay_events" {+ type = "SimpleAggregateFunction(max, Bool)"}- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ engine "distributed" {+ cluster_name = "posthog"+ remote_database = "posthog"+ remote_table = "sharded_raw_sessions_v3"+ sharding_key = "cityHash64(session_id_v7)"}- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ }++ table "session_replay_embeddings" {+ column "session_id" {+ type = "String"}- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "team_id" {+ type = "Int64"}- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "embeddings" {+ type = "Array(Float32)"}- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"+ column "generation_timestamp" {+ type = "DateTime64(6, 'UTC')"+ default = "now('UTC')"}- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "source_type" {+ type = "LowCardinality(String)"}- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "input" {+ type = "String"}- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"+ engine "distributed" {+ cluster_name = "posthog"+ remote_database = "posthog"+ remote_table = "sharded_session_replay_embeddings"+ sharding_key = "sipHash64(session_id)"}- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ }++ table "session_replay_events" {+ column "session_id" {+ type = "String"}- column "query" {- type = "SimpleAggregateFunction(max, String)"+ column "team_id" {+ type = "Int64"}- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"+ column "distinct_id" {+ type = "String"}- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"+ column "min_first_timestamp" {+ type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"}- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"+ column "max_last_timestamp" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"+ column "first_url" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "exception" {- type = "SimpleAggregateFunction(max, String)"+ column "click_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"+ column "keypress_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "mouse_activity_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "active_milliseconds" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "console_log_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "console_warn_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "console_error_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "size" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "message_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "event_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "_timestamp" {+ type = "SimpleAggregateFunction(max, DateTime)"}- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "snapshot_source" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "all_urls" {+ type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"}- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "snapshot_library" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "block_first_timestamps" {+ type = "SimpleAggregateFunction(groupArrayArray, Array(DateTime64(6, 'UTC')))"}- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "block_last_timestamps" {+ type = "SimpleAggregateFunction(groupArrayArray, Array(DateTime64(6, 'UTC')))"}- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "block_urls" {+ type = "SimpleAggregateFunction(groupArrayArray, Array(String))"}- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "retention_period_days" {+ type = "SimpleAggregateFunction(max, Nullable(Int64))"}- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "is_deleted" {+ type = "SimpleAggregateFunction(max, UInt8)"+ default = "0"}- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "ai_tags_fixed" {+ type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"}- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "ai_tags_freeform" {+ type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"}- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "ai_highlighted" {+ type = "SimpleAggregateFunction(max, UInt8)"+ default = "0"}- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "surfacing_score" {+ type = "SimpleAggregateFunction(max, Nullable(Float32))"}- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "snapshot_mode_v2" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"+ engine "distributed" {+ cluster_name = "posthog"+ remote_database = "posthog"+ remote_table = "sharded_session_replay_events"+ sharding_key = "sipHash64(distinct_id)"}- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"+ }++ table "session_replay_features" {+ column "session_id" {+ type = "String"}- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "team_id" {+ type = "Int64"}- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "distinct_id" {+ type = "String"}- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "min_first_timestamp" {+ type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"}- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"+ column "max_last_timestamp" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "event_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"+ column "mouse_position_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"+ column "mouse_sum_x" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "mouse_sum_x_squared" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "mouse_sum_y" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"+ column "mouse_sum_y_squared" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"+ column "mouse_distance_traveled" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "mouse_direction_change_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"+ column "mouse_velocity_sum" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"+ column "mouse_velocity_sum_of_squares" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "mouse_velocity_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "scroll_event_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"+ column "total_scroll_magnitude" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"+ column "scroll_direction_reversal_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"+ column "rapid_scroll_reversal_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"+ column "scroll_to_top_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "click_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "keypress_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "mouse_activity_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"+ column "rage_click_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "dead_click_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"+ column "backspace_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"+ column "inter_action_gap_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "inter_action_gap_sum_ms" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"+ column "inter_action_gap_sum_of_squares_ms" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"+ column "max_idle_gap_ms" {+ type = "SimpleAggregateFunction(max, Float64)"}- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "long_idle_gap_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "quick_back_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "page_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "unique_url_count" {+ type = "AggregateFunction(uniqCombined(12), String)"}- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"+ column "login_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"+ column "signup_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"+ column "checkout_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "cart_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "billing_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"+ column "settings_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "account_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "error_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "not_found_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "admin_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "dashboard_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "onboarding_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"+ column "cancel_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"+ column "refund_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "console_error_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"+ column "console_error_after_click_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"+ column "console_warn_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"+ column "network_request_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"+ column "network_failed_request_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"+ column "network_4xx_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"+ column "network_5xx_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"+ column "network_request_duration_sum" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "query_id" {- type = "String"+ column "network_request_duration_sum_of_squares" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "event_time" {- type = "DateTime('UTC')"+ column "network_request_duration_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "event_date" {- type = "Date"+ column "mutation_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "query_start_time" {- type = "DateTime('UTC')"+ column "viewport_resize_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"+ column "touch_event_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "query_kind" {- type = "LowCardinality(String)"+ column "max_scroll_y" {+ type = "SimpleAggregateFunction(max, Float64)"}- column "formatted_query" {- type = "String"+ column "unique_click_target_count" {+ type = "AggregateFunction(uniqCombined(12), Int64)"}- column "query_shape" {- type = "String"+ column "unique_form_field_count" {+ type = "AggregateFunction(uniqCombined(12), Int64)"}- column "hogql_shape" {- type = "String"+ column "text_selection_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "exception_name" {- type = "String"+ column "selection_copy_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents" {- type = "Map(String, UInt64)"+ column "is_deleted" {+ type = "SimpleAggregateFunction(max, UInt8)"+ default = "0"}engine "distributed" {- cluster_name = "ops"+ cluster_name = "aux"remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"+ remote_table = "sharded_session_replay_features"+ sharding_key = "sipHash64(session_id)"}}- table "raw_sessions" {+ table "sessions" {+ column "session_id" {+ type = "String"+ }column "team_id" {type = "Int64"}- column "session_id_v7" {- type = "UInt128"- }column "distinct_id" {- type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"+ type = "SimpleAggregateFunction(any, String)"}column "min_timestamp" {type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"@@ -4793,57 +4789,15 @@ database "posthog" {column "max_timestamp" {type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "max_inserted_at" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }column "urls" {type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"}column "entry_url" {type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "end_url" {- type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"- }- column "last_external_click_url" {+ column "exit_url" {type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"}- column "initial_browser" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_browser_version" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_os" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_os_version" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_device_type" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_viewport_width" {- type = "AggregateFunction(argMin, Int64, DateTime64(6, 'UTC'))"- }- column "initial_viewport_height" {- type = "AggregateFunction(argMin, Int64, DateTime64(6, 'UTC'))"- }- column "initial_geoip_country_code" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_geoip_subdivision_1_code" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_geoip_subdivision_1_name" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_geoip_subdivision_city_name" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_geoip_time_zone" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }column "initial_referring_domain" {type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}@@ -4910,1381 +4864,157 @@ database "posthog" {column "initial_sccid" {type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "initial__kx" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_irclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "event_count_map" {+ type = "SimpleAggregateFunction(sumMap, Map(String, Int64))"}column "pageview_count" {type = "SimpleAggregateFunction(sum, Int64)"}- column "pageview_uniq" {- type = "AggregateFunction(uniq, Nullable(UUID))"- }column "autocapture_count" {type = "SimpleAggregateFunction(sum, Int64)"}- column "autocapture_uniq" {- type = "AggregateFunction(uniq, Nullable(UUID))"- }- column "screen_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "screen_uniq" {- type = "AggregateFunction(uniq, Nullable(UUID))"- }- column "maybe_has_session_replay" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "page_screen_autocapture_uniq_up_to" {- type = "AggregateFunction(uniqUpTo(1), Nullable(UUID))"- }- column "vitals_lcp" {- type = "AggregateFunction(argMin, Nullable(Float64), DateTime64(6, 'UTC'))"- }engine "distributed" {cluster_name = "posthog"remote_database = "posthog"- remote_table = "sharded_raw_sessions"- sharding_key = "cityHash64(session_id_v7)"+ remote_table = "sharded_sessions"+ sharding_key = "sipHash64(session_id)"}}- table "raw_sessions_v3" {+ table "sharded_app_metrics" {+ order_by = ["team_id", "plugin_config_id", "job_id", "category", "toStartOfHour(timestamp)", "error_type", "error_uuid"]+ partition_by = "toYYYYMM(timestamp)"+ settings = {+ index_granularity = "8192"+ }column "team_id" {type = "Int64"}- column "session_id_v7" {- type = "UInt128"- }- column "session_timestamp" {- type = "DateTime64(3)"- materialized = "fromUnixTimestamp64Milli(toUInt64(bitShiftRight(session_id_v7, 80)))"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "distinct_id" {- type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"+ column "plugin_config_id" {+ type = "Int64"}- column "distinct_ids" {- type = "AggregateFunction(groupUniqArray, String)"+ column "category" {+ type = "LowCardinality(String)"}- column "min_timestamp" {- type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"+ column "job_id" {+ type = "String"}- column "max_timestamp" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "max_inserted_at" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "urls" {- type = "SimpleAggregateFunction(groupUniqArrayArray(2000), Array(String))"- }- column "entry_url" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "end_url" {- type = "AggregateFunction(argMax, Nullable(String), DateTime64(6, 'UTC'))"- }- column "last_external_click_url" {- type = "AggregateFunction(argMax, Nullable(String), DateTime64(6, 'UTC'))"- }- column "browser" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "browser_version" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "os" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "os_version" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "device_type" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "viewport_width" {- type = "AggregateFunction(argMin, Nullable(Int64), DateTime64(6, 'UTC'))"- }- column "viewport_height" {- type = "AggregateFunction(argMin, Nullable(Int64), DateTime64(6, 'UTC'))"- }- column "geoip_country_code" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "geoip_subdivision_1_code" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "geoip_subdivision_1_name" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "geoip_subdivision_city_name" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "geoip_time_zone" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "entry_referring_domain" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "entry_utm_source" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "entry_utm_campaign" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "entry_utm_medium" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "entry_utm_term" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "entry_utm_content" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "entry_gclid" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "entry_gad_source" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "entry_fbclid" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "entry_has_gclid" {- type = "AggregateFunction(argMin, Bool, DateTime64(6, 'UTC'))"- }- column "entry_has_fbclid" {- type = "AggregateFunction(argMin, Bool, DateTime64(6, 'UTC'))"- }- column "entry_ad_ids_map" {- type = "AggregateFunction(argMin, Map(String, String), DateTime64(6, 'UTC'))"- }- column "entry_ad_ids_set" {- type = "AggregateFunction(argMin, Array(String), DateTime64(6, 'UTC'))"- }- column "entry_channel_type_properties" {- type = "AggregateFunction(argMin, Tuple(Nullable(String), Nullable(String), Nullable(String), Nullable(String), Bool, Bool, Nullable(String)), DateTime64(6, 'UTC'))"- }- column "pageview_uniq" {- type = "AggregateFunction(uniqExact, Nullable(UUID))"- }- column "autocapture_uniq" {- type = "AggregateFunction(uniqExact, Nullable(UUID))"- }- column "screen_uniq" {- type = "AggregateFunction(uniqExact, Nullable(UUID))"+ column "successes" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "page_screen_uniq_up_to" {- type = "AggregateFunction(uniqUpTo(1), Nullable(UUID))"+ column "successes_on_retry" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "has_autocapture" {- type = "SimpleAggregateFunction(max, Bool)"+ column "failures" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "flag_key_values" {- type = "SimpleAggregateFunction(groupUniqArrayArray(10000), Array(String))"+ column "error_uuid" {+ type = "UUID"}- column "flag_keys" {- type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"+ column "error_type" {+ type = "String"}- column "event_names" {- type = "SimpleAggregateFunction(groupUniqArrayArray(2000), Array(String))"+ column "error_details" {+ type = "String"+ codec = "ZSTD(3)"}- column "hosts" {- type = "SimpleAggregateFunction(groupUniqArrayArray(100), Array(String))"+ column "_timestamp" {+ type = "DateTime"}- column "emails" {- type = "SimpleAggregateFunction(groupUniqArrayArray(10), Array(String))"+ column "_offset" {+ type = "UInt64"}- column "has_replay_events" {- type = "SimpleAggregateFunction(max, Bool)"+ column "_partition" {+ type = "UInt64"}- engine "distributed" {- cluster_name = "posthog"- remote_database = "posthog"- remote_table = "sharded_raw_sessions_v3"- sharding_key = "cityHash64(session_id_v7)"+ engine "replicated_aggregating_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_app_metrics"+ replica_name = "{replica}"}}- table "session_replay_embeddings" {- column "session_id" {- type = "String"+ table "sharded_app_metrics2" {+ order_by = ["team_id", "app_source", "app_source_id", "instance_id", "toStartOfHour(timestamp)", "metric_kind", "metric_name"]+ partition_by = "toYYYYMM(timestamp)"+ ttl = "toDate(timestamp) + toIntervalDay(90)"+ settings = {+ index_granularity = "8192"}column "team_id" {type = "Int64"}- column "embeddings" {- type = "Array(Float32)"- }- column "generation_timestamp" {- type = "DateTime64(6, 'UTC')"- default = "now('UTC')"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "source_type" {+ column "app_source" {type = "LowCardinality(String)"}- column "input" {- type = "String"- }- engine "distributed" {- cluster_name = "posthog"- remote_database = "posthog"- remote_table = "sharded_session_replay_embeddings"- sharding_key = "sipHash64(session_id)"- }- }-- table "session_replay_events" {- column "session_id" {+ column "app_source_id" {type = "String"}- column "team_id" {- type = "Int64"- }- column "distinct_id" {+ column "instance_id" {type = "String"}- column "min_first_timestamp" {- type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"- }- column "max_last_timestamp" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "first_url" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "click_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "keypress_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "mouse_activity_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "active_milliseconds" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "console_log_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "console_warn_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "console_error_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "size" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "metric_kind" {+ type = "LowCardinality(String)"}- column "message_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "metric_name" {+ type = "LowCardinality(String)"}- column "event_count" {+ column "count" {type = "SimpleAggregateFunction(sum, Int64)"}column "_timestamp" {- type = "SimpleAggregateFunction(max, DateTime)"- }- column "snapshot_source" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "all_urls" {- type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"- }- column "snapshot_library" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- column "block_first_timestamps" {- type = "SimpleAggregateFunction(groupArrayArray, Array(DateTime64(6, 'UTC')))"- }- column "block_last_timestamps" {- type = "SimpleAggregateFunction(groupArrayArray, Array(DateTime64(6, 'UTC')))"- }- column "block_urls" {- type = "SimpleAggregateFunction(groupArrayArray, Array(String))"+ type = "DateTime"}- column "retention_period_days" {- type = "SimpleAggregateFunction(max, Nullable(Int64))"+ column "_offset" {+ type = "UInt64"}- column "is_deleted" {- type = "SimpleAggregateFunction(max, UInt8)"- default = "0"+ column "_partition" {+ type = "UInt64"}- column "ai_tags_fixed" {- type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"- }- column "ai_tags_freeform" {- type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"- }- column "ai_highlighted" {- type = "SimpleAggregateFunction(max, UInt8)"- default = "0"- }- column "surfacing_score" {- type = "SimpleAggregateFunction(max, Nullable(Float32))"- }- column "snapshot_mode_v2" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"- }- engine "distributed" {- cluster_name = "posthog"- remote_database = "posthog"- remote_table = "sharded_session_replay_events"- sharding_key = "sipHash64(distinct_id)"- }- }-- table "session_replay_features" {- column "session_id" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "distinct_id" {- type = "String"- }- column "min_first_timestamp" {- type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"- }- column "max_last_timestamp" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "event_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "mouse_position_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "mouse_sum_x" {- type = "SimpleAggregateFunction(sum, Float64)"- }- column "mouse_sum_x_squared" {- type = "SimpleAggregateFunction(sum, Float64)"- }- column "mouse_sum_y" {- type = "SimpleAggregateFunction(sum, Float64)"- }- column "mouse_sum_y_squared" {- type = "SimpleAggregateFunction(sum, Float64)"- }- column "mouse_distance_traveled" {- type = "SimpleAggregateFunction(sum, Float64)"- }- column "mouse_direction_change_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "mouse_velocity_sum" {- type = "SimpleAggregateFunction(sum, Float64)"- }- column "mouse_velocity_sum_of_squares" {- type = "SimpleAggregateFunction(sum, Float64)"- }- column "mouse_velocity_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "scroll_event_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "total_scroll_magnitude" {- type = "SimpleAggregateFunction(sum, Float64)"- }- column "scroll_direction_reversal_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "rapid_scroll_reversal_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "scroll_to_top_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "click_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "keypress_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "mouse_activity_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "rage_click_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "dead_click_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "backspace_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "inter_action_gap_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "inter_action_gap_sum_ms" {- type = "SimpleAggregateFunction(sum, Float64)"- }- column "inter_action_gap_sum_of_squares_ms" {- type = "SimpleAggregateFunction(sum, Float64)"- }- column "max_idle_gap_ms" {- type = "SimpleAggregateFunction(max, Float64)"- }- column "long_idle_gap_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "quick_back_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "page_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "unique_url_count" {- type = "AggregateFunction(uniqCombined(12), String)"- }- column "login_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "signup_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "checkout_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "cart_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "billing_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "settings_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "account_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "error_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "not_found_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "admin_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "dashboard_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "onboarding_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "cancel_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "refund_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "console_error_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "console_error_after_click_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "console_warn_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "network_request_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "network_failed_request_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "network_4xx_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "network_5xx_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "network_request_duration_sum" {- type = "SimpleAggregateFunction(sum, Float64)"- }- column "network_request_duration_sum_of_squares" {- type = "SimpleAggregateFunction(sum, Float64)"- }- column "network_request_duration_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "mutation_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "viewport_resize_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "touch_event_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "max_scroll_y" {- type = "SimpleAggregateFunction(max, Float64)"- }- column "unique_click_target_count" {- type = "AggregateFunction(uniqCombined(12), Int64)"- }- column "unique_form_field_count" {- type = "AggregateFunction(uniqCombined(12), Int64)"- }- column "text_selection_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "selection_copy_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "is_deleted" {- type = "SimpleAggregateFunction(max, UInt8)"- default = "0"- }- engine "distributed" {- cluster_name = "aux"- remote_database = "posthog"- remote_table = "sharded_session_replay_features"- sharding_key = "sipHash64(session_id)"- }- }-- table "sessions" {- column "session_id" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "distinct_id" {- type = "SimpleAggregateFunction(any, String)"- }- column "min_timestamp" {- type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"- }- column "max_timestamp" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "urls" {- type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"- }- column "entry_url" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "exit_url" {- type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"- }- column "initial_referring_domain" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_utm_source" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_utm_campaign" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_utm_medium" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_utm_term" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_utm_content" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_gclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_gad_source" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_gclsrc" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_dclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_gbraid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_wbraid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_fbclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_msclkid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_twclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_li_fat_id" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_mc_cid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_igshid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_ttclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_epik" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_qclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_sccid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "event_count_map" {- type = "SimpleAggregateFunction(sumMap, Map(String, Int64))"- }- column "pageview_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "autocapture_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- engine "distributed" {- cluster_name = "posthog"- remote_database = "posthog"- remote_table = "sharded_sessions"- sharding_key = "sipHash64(session_id)"- }- }-- table "sharded_app_metrics" {- order_by = ["team_id", "plugin_config_id", "job_id", "category", "toStartOfHour(timestamp)", "error_type", "error_uuid"]- partition_by = "toYYYYMM(timestamp)"- settings = {- index_granularity = "8192"- }- column "team_id" {- type = "Int64"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "plugin_config_id" {- type = "Int64"- }- column "category" {- type = "LowCardinality(String)"- }- column "job_id" {- type = "String"- }- column "successes" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "successes_on_retry" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "failures" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "error_uuid" {- type = "UUID"- }- column "error_type" {- type = "String"- }- column "error_details" {- type = "String"- codec = "ZSTD(3)"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "_partition" {- type = "UInt64"- }- engine "replicated_aggregating_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_app_metrics"- replica_name = "{replica}"- }- }-- table "sharded_app_metrics2" {- order_by = ["team_id", "app_source", "app_source_id", "instance_id", "toStartOfHour(timestamp)", "metric_kind", "metric_name"]- partition_by = "toYYYYMM(timestamp)"- ttl = "toDate(timestamp) + toIntervalDay(90)"- settings = {- index_granularity = "8192"- }- column "team_id" {- type = "Int64"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "app_source" {- type = "LowCardinality(String)"- }- column "app_source_id" {- type = "String"- }- column "instance_id" {- type = "String"- }- column "metric_kind" {- type = "LowCardinality(String)"- }- column "metric_name" {- type = "LowCardinality(String)"- }- column "count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "_partition" {- type = "UInt64"- }- engine "replicated_aggregating_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_app_metrics2"- replica_name = "{replica}"- }- }-- table "sharded_distinct_id_usage" {- order_by = ["team_id", "minute", "distinct_id"]- partition_by = "toYYYYMMDD(minute)"- ttl = "toDate(minute) + toIntervalDay(7)"- settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"- }- column "team_id" {- type = "Int64"- }- column "distinct_id" {- type = "String"- }- column "minute" {- type = "DateTime"- }- column "event_count" {- type = "UInt64"- }- engine "replicated_summing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.distinct_id_usage"- replica_name = "{replica}"- sum_columns = ["event_count"]- }- }-- table "sharded_events" {- order_by = ["team_id", "toDate(timestamp)", "event", "cityHash64(distinct_id)", "cityHash64(uuid)"]- partition_by = "toYYYYMM(timestamp)"- sample_by = "cityHash64(distinct_id)"- settings = {- index_granularity = "8192"- }- column "uuid" {- type = "UUID"- }- column "event" {- type = "String"- }- column "properties" {- type = "String"- codec = "ZSTD(3)"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "distinct_id" {- type = "String"- }- column "created_at" {- type = "DateTime64(6, 'UTC')"- }- column "$group_0" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^\"|\"$', '')"- comment = "column_materializer::$group_0"- }- column "$group_1" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_1'), '^\"|\"$', '')"- comment = "column_materializer::$group_1"- }- column "$group_2" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_2'), '^\"|\"$', '')"- comment = "column_materializer::$group_2"- }- column "$group_3" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_3'), '^\"|\"$', '')"- comment = "column_materializer::$group_3"- }- column "$group_4" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_4'), '^\"|\"$', '')"- comment = "column_materializer::$group_4"- }- column "$window_id" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$window_id'), '^\"|\"$', '')"- comment = "column_materializer::$window_id"- }- column "$session_id" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$session_id'), '^\"|\"$', '')"- comment = "column_materializer::$session_id"- }- column "inserted_at" {- type = "Nullable(DateTime64(6, 'UTC'))"- default = "now64()"- }- column "person_mode" {- type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"- }- column "elements_chain_href" {- type = "String"- materialized = "EXTRACT(elements_chain, '(?::|\")href=\"(.*?)\"')"- }- column "elements_chain_texts" {- type = "Array(String)"- materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")text=\"(.*?)\"'))"- }- column "elements_chain_ids" {- type = "Array(String)"- materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")attr_id=\"(.*?)\"'))"- }- column "elements_chain_elements" {- type = "Array(Enum8('a'=1, 'button'=2, 'form'=3, 'input'=4, 'select'=5, 'textarea'=6, 'label'=7))"- materialized = "arrayDistinct(extractAll(elements_chain, '(?:^|;)(a|button|form|input|select|textarea|label)(?:\\\\.|$|:)'))"- }- column "properties_group_custom" {- type = "Map(String, String)"- materialized = "mapSort(mapFilter((key, _) -> ((key NOT LIKE '$%') AND (key NOT IN ('token', 'distinct_id', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'gclid', 'gad_source', 'gclsrc', 'dclid', 'gbraid', 'wbraid', 'fbclid', 'msclkid', 'twclid', 'li_fat_id', 'mc_cid', 'igshid', 'ttclid', 'rdt_cid', 'epik', 'qclid', 'sccid', 'irclid', '_kx'))), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"- codec = "ZSTD(1)"- }- column "properties_group_feature_flags" {- type = "Map(String, String)"- materialized = "mapSort(mapFilter((key, _) -> (key LIKE '$feature/%'), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"- codec = "ZSTD(1)"- }- column "is_deleted" {- type = "Bool"- }- column "person_properties_map_custom" {- type = "Map(String, String)"- materialized = "mapSort(mapFilter((key, _) -> (key NOT LIKE '$%'), CAST(JSONExtractKeysAndValues(person_properties, 'String'), 'Map(String, String)')))"- codec = "ZSTD(1)"- }- column "$session_id_uuid" {- type = "Nullable(UInt128)"- materialized = "toUInt128(JSONExtract(properties, '$session_id', 'Nullable(UUID)'))"- }- column "consumer_breadcrumbs" {- type = "Array(String)"- }- column "properties_group_ai" {- type = "Map(String, String)"- materialized = "mapSort(mapFilter((key, _) -> ((key LIKE '$ai_%') AND (key NOT IN ('$ai_input', '$ai_input_state', '$ai_output', '$ai_output_choices', '$ai_output_state', '$ai_tools'))), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"- codec = "ZSTD(1)"- }- column "mat_$ai_session_id" {- type = "Nullable(String)"- materialized = "JSONExtract(properties, '$ai_session_id', 'Nullable(String)')"- }- column "mat_$ai_is_error" {- type = "Nullable(String)"- materialized = "JSONExtract(properties, '$ai_is_error', 'Nullable(String)')"- }- column "dmat_string_0" {- type = "Nullable(String)"- }- column "dmat_string_1" {- type = "Nullable(String)"- }- column "dmat_string_2" {- type = "Nullable(String)"- }- column "dmat_string_3" {- type = "Nullable(String)"- }- column "dmat_string_4" {- type = "Nullable(String)"- }- column "dmat_string_5" {- type = "Nullable(String)"- }- column "dmat_string_6" {- type = "Nullable(String)"- }- column "dmat_string_7" {- type = "Nullable(String)"- }- column "dmat_string_8" {- type = "Nullable(String)"- }- column "dmat_string_9" {- type = "Nullable(String)"- }- column "historical_migration" {- type = "Bool"- }- column "mat_$ai_prompt_name" {- type = "Nullable(String)"- materialized = "JSONExtract(properties, '$ai_prompt_name', 'Nullable(String)')"- }- column "properties_map_ephemeral" {- type = "Map(String, String)"- }- column "person_properties_map_ephemeral" {- type = "Map(String, String)"- }- column "mat_$ai_experiment_id" {- type = "Nullable(String)"- default = "JSONExtract(properties, '$ai_experiment_id', 'Nullable(String)')"- }- column "elements_chain" {- type = "String"- }- column "person_id" {- type = "UUID"- }- column "person_created_at" {- type = "DateTime64(3)"- }- column "person_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group0_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group1_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group2_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group3_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group4_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group0_created_at" {- type = "DateTime64(3)"- }- column "group1_created_at" {- type = "DateTime64(3)"- }- column "group2_created_at" {- type = "DateTime64(3)"- }- column "group3_created_at" {- type = "DateTime64(3)"- }- column "group4_created_at" {- type = "DateTime64(3)"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "mat_$ai_trace_id" {- type = "Nullable(String)"- materialized = "JSONExtract(properties, '$ai_trace_id', 'Nullable(String)')"- }- index "minmax_inserted_at" {- expr = "coalesce(inserted_at, _timestamp)"- type = "minmax"- granularity = 1- }- index "properties_group_custom_keys_bf" {- expr = "mapKeys(properties_group_custom)"- type = "bloom_filter"- granularity = 1- }- index "properties_group_custom_values_bf" {- expr = "mapValues(properties_group_custom)"- type = "bloom_filter"- granularity = 1- }- index "properties_group_feature_flags_keys_bf" {- expr = "mapKeys(properties_group_feature_flags)"- type = "bloom_filter"- granularity = 1- }- index "properties_group_feature_flags_values_bf" {- expr = "mapValues(properties_group_feature_flags)"- type = "bloom_filter"- granularity = 1- }- index "person_properties_map_custom_keys_bf" {- expr = "mapKeys(person_properties_map_custom)"- type = "bloom_filter"- granularity = 1- }- index "person_properties_map_custom_values_bf" {- expr = "mapValues(person_properties_map_custom)"- type = "bloom_filter"- granularity = 1- }- index "properties_group_ai_keys_bf" {- expr = "mapKeys(properties_group_ai)"- type = "bloom_filter"- granularity = 1- }- index "properties_group_ai_values_bf" {- expr = "mapValues(properties_group_ai)"- type = "bloom_filter"- granularity = 1- }- index "bloom_filter_$ai_trace_id" {- expr = "`mat_$ai_trace_id`"- type = "bloom_filter(0.001)"- granularity = 2- }- index "bloom_filter_$ai_session_id" {- expr = "`mat_$ai_session_id`"- type = "bloom_filter"- granularity = 1- }- index "minmax_$ai_session_id" {- expr = "`mat_$ai_session_id`"- type = "minmax"- granularity = 1- }- index "set_$ai_is_error" {- expr = "`mat_$ai_is_error`"- type = "set(7)"- granularity = 1- }- index "bloom_filter_distinct_id" {- expr = "distinct_id"- type = "bloom_filter"- granularity = 1- }- index "minmax_sharded_events_timestamp" {- expr = "timestamp"- type = "minmax"- granularity = 1- }- index "bloom_filter_$ai_prompt_name" {- expr = "`mat_$ai_prompt_name`"- type = "bloom_filter"- granularity = 1- }- index "minmax_$ai_prompt_name" {- expr = "`mat_$ai_prompt_name`"- type = "minmax"- granularity = 1- }- index "bloom_filter_$ai_experiment_id" {- expr = "`mat_$ai_experiment_id`"- type = "bloom_filter"- granularity = 1- }- index "minmax_$ai_experiment_id" {- expr = "`mat_$ai_experiment_id`"- type = "minmax"- granularity = 1- }- index "minmax_$session_id_uuid" {- expr = "`$session_id_uuid`"- type = "minmax"- granularity = 1- }- index "bloom_filter_$session_id" {- expr = "nullIf(nullIf(`$session_id`, ''), 'null')"- type = "bloom_filter"- granularity = 1- }- index "minmax_$group_0" {- expr = "`$group_0`"- type = "minmax"- granularity = 1- }- index "minmax_$group_1" {- expr = "`$group_1`"- type = "minmax"- granularity = 1- }- index "minmax_$group_2" {- expr = "`$group_2`"- type = "minmax"- granularity = 1- }- index "minmax_$group_3" {- expr = "`$group_3`"- type = "minmax"- granularity = 1- }- index "minmax_$group_4" {- expr = "`$group_4`"- type = "minmax"- granularity = 1- }- index "minmax_$window_id" {- expr = "`$window_id`"- type = "minmax"- granularity = 1- }- index "minmax_$session_id" {- expr = "`$session_id`"- type = "minmax"- granularity = 1- }- index "kafka_timestamp_minmax_sharded_events" {- expr = "_timestamp"- type = "minmax"- granularity = 3- }- index "is_deleted_idx" {- expr = "is_deleted"- type = "minmax"- granularity = 1- }- index "minmax_historical_migration" {- expr = "historical_migration"- type = "minmax"- granularity = 1- }- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.events"- replica_name = "{replica}"- version_column = "_timestamp"- }- }-- table "sharded_events_json" {- primary_key = ["team_id", "toDate(timestamp)", "event", "cityHash64(distinct_id)"]- order_by = ["team_id", "toDate(timestamp)", "event", "cityHash64(distinct_id)", "timestamp", "uuid"]- partition_by = "clamp(toYYYYMM(timestamp), 202001, 203512)"- sample_by = "cityHash64(distinct_id)"- settings = {- enable_block_number_column = "1"- enable_block_offset_column = "1"- index_granularity = "8192"- map_serialization_version = "with_buckets"- object_serialization_version = "v3"- object_shared_data_serialization_version = "map_with_buckets"- propagate_types_serialization_versions_to_nested_types = "1"- string_serialization_version = "single_stream"- }- column "uuid" {- type = "UUID"- }- column "event" {- type = "String"- }- column "properties" {- type = "JSON(`$browser` LowCardinality(String), `$browser_language` LowCardinality(String), `$browser_version` LowCardinality(String), `$config_defaults` LowCardinality(String), `$device_type` LowCardinality(String), `$exception_functions` Array(String), `$exception_list` Array(JSON(max_dynamic_paths=0, type String, value String)), `$exception_sources` Array(String), `$exception_types` Array(String), `$exception_values` Array(String), `$feature_flags` Map(LowCardinality(String), LowCardinality(String)), `$geoip_city_name` LowCardinality(String), `$geoip_continent_code` LowCardinality(String), `$geoip_continent_name` LowCardinality(String), `$geoip_country_code` LowCardinality(String), `$geoip_country_name` LowCardinality(String), `$geoip_subdivision_1_name` LowCardinality(String), `$geoip_time_zone` LowCardinality(String), `$group_0` String, `$group_1` String, `$group_2` String, `$group_3` String, `$group_4` String, `$lib` LowCardinality(String), `$lib_version` LowCardinality(String), `$mcp_listed_tool_names` Array(String), `$os` LowCardinality(String), `$os_version` LowCardinality(String), `$session_id` String, `$timezone` LowCardinality(String), `$window_id` String)"- }- column "temporary_properties" {- type = "JSON(max_dynamic_paths=32)"- ttl = "toDateTime(inserted_at) + toIntervalDay(60)"- }- column "properties_null_keys" {- type = "Array(LowCardinality(String))"- }- column "temporary_properties_null_keys" {- type = "Array(LowCardinality(String))"- ttl = "toDateTime(inserted_at) + toIntervalDay(60)"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- codec = "GCD, Default"- }- column "team_id" {- type = "Int64"- }- column "distinct_id" {- type = "String"- }- column "created_at" {- type = "DateTime64(6, 'UTC')"- default = "now()"- codec = "GCD, Default"- }- column "_timestamp" {- type = "DateTime"- codec = "T64, Default"- }- column "_offset" {- type = "UInt64"- codec = "T64, Default"- }- column "elements_chain" {- type = "String"- }- column "person_id" {- type = "UUID"- }- column "person_properties" {- type = "JSON(max_dynamic_paths=256, `$browser` LowCardinality(String), `$browser_language` LowCardinality(String), `$browser_version` LowCardinality(String), `$device_type` LowCardinality(String), `$geoip_city_name` LowCardinality(String), `$geoip_continent_code` LowCardinality(String), `$geoip_continent_name` LowCardinality(String), `$geoip_country_code` LowCardinality(String), `$geoip_country_name` LowCardinality(String), `$geoip_subdivision_1_name` LowCardinality(String), `$geoip_time_zone` LowCardinality(String), `$initial_browser` LowCardinality(String), `$initial_browser_language` LowCardinality(String), `$initial_browser_version` LowCardinality(String), `$initial_device_type` LowCardinality(String), `$initial_geoip_city_name` LowCardinality(String), `$initial_geoip_continent_code` LowCardinality(String), `$initial_geoip_continent_name` LowCardinality(String), `$initial_geoip_country_code` LowCardinality(String), `$initial_geoip_country_name` LowCardinality(String), `$initial_geoip_subdivision_1_name` LowCardinality(String), `$initial_geoip_time_zone` LowCardinality(String), `$initial_os` LowCardinality(String), `$initial_os_version` LowCardinality(String), `$os` LowCardinality(String), `$os_version` LowCardinality(String))"- }- column "person_properties_null_keys" {- type = "Array(LowCardinality(String))"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }- column "person_created_at" {- type = "DateTime64(3)"- codec = "GCD, Default"- }- column "group0_created_at" {- type = "DateTime64(3)"- }- column "group1_created_at" {- type = "DateTime64(3)"- }- column "group2_created_at" {- type = "DateTime64(3)"- }- column "group3_created_at" {- type = "DateTime64(3)"- }- column "group4_created_at" {- type = "DateTime64(3)"- }- column "inserted_at" {- type = "DateTime64(6, 'UTC')"- default = "now64()"- codec = "GCD, Default"- }- column "person_mode" {- type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"- }- column "consumer_breadcrumbs" {- type = "Array(String)"- }- column "historical_migration" {- type = "Bool"- }- column "total_event_size" {- type = "UInt32"- codec = "T64, Default"- }- column "captured_at" {- type = "DateTime64(6, 'UTC')"- default = "now()"- codec = "GCD, Default"- }- column "_partition" {- type = "UInt64"- codec = "T64, Default"- }- column "elements_chain_href" {- type = "String"- materialized = "EXTRACT(elements_chain, '(?::|\")href=\"(.*?)\"')"- }- column "elements_chain_texts" {- type = "Array(String)"- materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")text=\"(.*?)\"'))"- }- column "elements_chain_ids" {- type = "Array(String)"- materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")attr_id=\"(.*?)\"'))"- }- column "elements_chain_elements" {- type = "Array(Enum8('a'=1, 'button'=2, 'form'=3, 'input'=4, 'select'=5, 'textarea'=6, 'label'=7))"- materialized = "arrayDistinct(extractAll(elements_chain, '(?:^|;)(a|button|form|input|select|textarea|label)(?:\\\\.|$|:)'))"- }- index "bloom_filter_distinct_id" {- expr = "distinct_id"- type = "bloom_filter"- granularity = 1- }- index "bloom_filter_uuid" {- expr = "uuid"- type = "bloom_filter"- granularity = 1- }- index "bloom_filter_person_id" {- expr = "person_id"- type = "bloom_filter"- granularity = 1- }- index "minmax_captured_at" {- expr = "captured_at"- type = "minmax"- granularity = 1+ engine "replicated_aggregating_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_app_metrics2"+ replica_name = "{replica}"}- index "minmax_kafka_timestamp" {- expr = "_timestamp"- type = "minmax"- granularity = 1+ }++ table "sharded_distinct_id_usage" {+ order_by = ["team_id", "minute", "distinct_id"]+ partition_by = "toYYYYMMDD(minute)"+ ttl = "toDate(minute) + toIntervalDay(7)"+ settings = {+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}- index "minmax_inserted_at" {- expr = "inserted_at"- type = "minmax"- granularity = 1+ column "team_id" {+ type = "Int64"}- index "minmax_timestamp" {- expr = "timestamp"- type = "minmax"- granularity = 1+ column "distinct_id" {+ type = "String"}- index "minmax_historical_migration" {- expr = "historical_migration"- type = "minmax"- granularity = 1+ column "minute" {+ type = "DateTime"}- index "minmax_created_at" {- expr = "created_at"- type = "minmax"- granularity = 1+ column "event_count" {+ type = "UInt64"}- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.events_json"- replica_name = "{replica}"- version_column = "_timestamp"+ engine "replicated_summing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.distinct_id_usage"+ replica_name = "{replica}"+ sum_columns = ["event_count"]}}- table "sharded_events_recent" {- order_by = ["team_id", "toStartOfHour(inserted_at)", "event", "cityHash64(distinct_id)", "cityHash64(uuid)"]- partition_by = "toStartOfDay(inserted_at)"- ttl = "toDate(inserted_at) + toIntervalDay(9)"+ table "sharded_events" {+ order_by = ["team_id", "toDate(timestamp)", "event", "cityHash64(distinct_id)", "cityHash64(uuid)"]+ partition_by = "toYYYYMM(timestamp)"+ sample_by = "cityHash64(distinct_id)"settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"+ index_granularity = "8192"}column "uuid" {type = "UUID"@@ -6305,228 +5035,199 @@ database "posthog" {column "distinct_id" {type = "String"}- column "elements_chain" {- type = "String"- }column "created_at" {type = "DateTime64(6, 'UTC')"}- column "person_id" {- type = "UUID"- }- column "person_created_at" {- type = "DateTime64(3)"+ column "$group_0" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^\"|\"$', '')"+ comment = "column_materializer::$group_0"}- column "person_properties" {- type = "String"- codec = "ZSTD(3)"+ column "$group_1" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_1'), '^\"|\"$', '')"+ comment = "column_materializer::$group_1"}- column "group0_properties" {- type = "String"- codec = "ZSTD(3)"+ column "$group_2" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_2'), '^\"|\"$', '')"+ comment = "column_materializer::$group_2"}- column "group1_properties" {- type = "String"- codec = "ZSTD(3)"+ column "$group_3" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_3'), '^\"|\"$', '')"+ comment = "column_materializer::$group_3"}- column "group2_properties" {- type = "String"- codec = "ZSTD(3)"+ column "$group_4" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_4'), '^\"|\"$', '')"+ comment = "column_materializer::$group_4"}- column "group3_properties" {- type = "String"- codec = "ZSTD(3)"+ column "$window_id" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$window_id'), '^\"|\"$', '')"+ comment = "column_materializer::$window_id"}- column "group4_properties" {- type = "String"- codec = "ZSTD(3)"+ column "$session_id" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$session_id'), '^\"|\"$', '')"+ comment = "column_materializer::$session_id"}- column "group0_created_at" {- type = "DateTime64(3)"+ column "inserted_at" {+ type = "Nullable(DateTime64(6, 'UTC'))"+ default = "now64()"}- column "group1_created_at" {- type = "DateTime64(3)"+ column "person_mode" {+ type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"}- column "group2_created_at" {- type = "DateTime64(3)"+ column "elements_chain_href" {+ type = "String"+ materialized = "EXTRACT(elements_chain, '(?::|\")href=\"(.*?)\"')"}- column "group3_created_at" {- type = "DateTime64(3)"+ column "elements_chain_texts" {+ type = "Array(String)"+ materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")text=\"(.*?)\"'))"}- column "group4_created_at" {- type = "DateTime64(3)"+ column "elements_chain_ids" {+ type = "Array(String)"+ materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")attr_id=\"(.*?)\"'))"}- column "person_mode" {- type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"+ column "elements_chain_elements" {+ type = "Array(Enum8('a'=1, 'button'=2, 'form'=3, 'input'=4, 'select'=5, 'textarea'=6, 'label'=7))"+ materialized = "arrayDistinct(extractAll(elements_chain, '(?:^|;)(a|button|form|input|select|textarea|label)(?:\\\\.|$|:)'))"}- column "historical_migration" {- type = "Bool"+ column "properties_group_custom" {+ type = "Map(String, String)"+ materialized = "mapSort(mapFilter((key, _) -> ((key NOT LIKE '$%') AND (key NOT IN ('token', 'distinct_id', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'gclid', 'gad_source', 'gclsrc', 'dclid', 'gbraid', 'wbraid', 'fbclid', 'msclkid', 'twclid', 'li_fat_id', 'mc_cid', 'igshid', 'ttclid', 'rdt_cid', 'epik', 'qclid', 'sccid', 'irclid', '_kx'))), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"+ codec = "ZSTD(1)"}- column "_timestamp" {- type = "DateTime"+ column "properties_group_feature_flags" {+ type = "Map(String, String)"+ materialized = "mapSort(mapFilter((key, _) -> (key LIKE '$feature/%'), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"+ codec = "ZSTD(1)"}- column "_offset" {- type = "UInt64"+ column "is_deleted" {+ type = "Bool"}- column "inserted_at" {- type = "DateTime64(6, 'UTC')"- default = "now64()"+ column "person_properties_map_custom" {+ type = "Map(String, String)"+ materialized = "mapSort(mapFilter((key, _) -> (key NOT LIKE '$%'), CAST(JSONExtractKeysAndValues(person_properties, 'String'), 'Map(String, String)')))"+ codec = "ZSTD(1)"}- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_events_recent"- replica_name = "{replica}"- version_column = "_timestamp"+ column "$session_id_uuid" {+ type = "Nullable(UInt128)"+ materialized = "toUInt128(JSONExtract(properties, '$session_id', 'Nullable(UUID)'))"}- }-- table "sharded_experiment_exposures_preaggregated" {- order_by = ["team_id", "job_id", "entity_id", "breakdown_value"]- partition_by = "toYYYYMMDD(expires_at)"- ttl = "expires_at"- settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"+ column "consumer_breadcrumbs" {+ type = "Array(String)"}- column "team_id" {- type = "Int64"+ column "properties_group_ai" {+ type = "Map(String, String)"+ materialized = "mapSort(mapFilter((key, _) -> ((key LIKE '$ai_%') AND (key NOT IN ('$ai_input', '$ai_input_state', '$ai_output', '$ai_output_choices', '$ai_output_state', '$ai_tools'))), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"+ codec = "ZSTD(1)"}- column "job_id" {- type = "UUID"+ column "mat_$ai_session_id" {+ type = "Nullable(String)"+ materialized = "JSONExtract(properties, '$ai_session_id', 'Nullable(String)')"}- column "entity_id" {- type = "String"+ column "mat_$ai_is_error" {+ type = "Nullable(String)"+ materialized = "JSONExtract(properties, '$ai_is_error', 'Nullable(String)')"}- column "variant" {- type = "String"+ column "dmat_string_0" {+ type = "Nullable(String)"}- column "first_exposure_time" {- type = "DateTime64(6, 'UTC')"+ column "dmat_string_1" {+ type = "Nullable(String)"}- column "last_exposure_time" {- type = "DateTime64(6, 'UTC')"+ column "dmat_string_2" {+ type = "Nullable(String)"}- column "exposure_event_uuid" {- type = "UUID"+ column "dmat_string_3" {+ type = "Nullable(String)"}- column "exposure_session_id" {- type = "String"+ column "dmat_string_4" {+ type = "Nullable(String)"}- column "breakdown_value" {- type = "Array(String)"+ column "dmat_string_5" {+ type = "Nullable(String)"}- column "computed_at" {- type = "DateTime64(6, 'UTC')"- default = "now()"+ column "dmat_string_6" {+ type = "Nullable(String)"}- column "expires_at" {- type = "Date"- default = "today() + toIntervalDay(7)"+ column "dmat_string_7" {+ type = "Nullable(String)"}- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.experiment_exposures_preaggregated"- replica_name = "{replica}"- version_column = "computed_at"+ column "dmat_string_8" {+ type = "Nullable(String)"}- }-- table "sharded_flag_evaluations" {- order_by = ["team_id", "flag_key", "toDate(timestamp)", "cityHash64(distinct_id)", "cityHash64(uuid)"]- partition_by = "toYYYYMM(timestamp)"- ttl = "toDate(timestamp) + toIntervalDay(90)"- settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"+ column "dmat_string_9" {+ type = "Nullable(String)"}- column "uuid" {- type = "UUID"+ column "historical_migration" {+ type = "Bool"}- column "event" {- type = "LowCardinality(String)"+ column "mat_$ai_prompt_name" {+ type = "Nullable(String)"+ materialized = "JSONExtract(properties, '$ai_prompt_name', 'Nullable(String)')"}- column "properties" {- type = "String"+ column "properties_map_ephemeral" {+ type = "Map(String, String)"}- column "timestamp" {- type = "DateTime64(6, 'UTC')"+ column "person_properties_map_ephemeral" {+ type = "Map(String, String)"}- column "team_id" {- type = "Int64"+ column "mat_$ai_experiment_id" {+ type = "Nullable(String)"+ default = "JSONExtract(properties, '$ai_experiment_id', 'Nullable(String)')"}- column "distinct_id" {+ column "elements_chain" {type = "String"}- column "created_at" {- type = "DateTime64(6, 'UTC')"- }column "person_id" {type = "UUID"}- column "person_properties" {- type = "String"- default = "'{}'"- }column "person_created_at" {type = "DateTime64(3)"}- column "inserted_at" {- type = "DateTime64(6, 'UTC')"- default = "timestamp"- }- column "person_mode" {- type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"- }- column "$group_0" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^\"|\"$', '')"- comment = "column_materializer::$group_0"+ column "person_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "$group_1" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_1'), '^\"|\"$', '')"- comment = "column_materializer::$group_1"+ column "group0_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "$group_2" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_2'), '^\"|\"$', '')"- comment = "column_materializer::$group_2"+ column "group1_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "$group_3" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_3'), '^\"|\"$', '')"- comment = "column_materializer::$group_3"+ column "group2_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "$group_4" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_4'), '^\"|\"$', '')"- comment = "column_materializer::$group_4"+ column "group3_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "flag_key" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$feature_flag'), '^\"|\"$', '')"- comment = "column_materializer::properties::$feature_flag"+ column "group4_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "response" {- type = "LowCardinality(String)"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$feature_flag_response'), '^\"|\"$', '')"- comment = "column_materializer::properties::$feature_flag_response"+ column "group0_created_at" {+ type = "DateTime64(3)"}- column "session_id" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$session_id'), '^\"|\"$', '')"- comment = "column_materializer::properties::$session_id"+ column "group1_created_at" {+ type = "DateTime64(3)"}- column "request_id" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$feature_flag_request_id'), '^\"|\"$', '')"- comment = "column_materializer::properties::$feature_flag_request_id"+ column "group2_created_at" {+ type = "DateTime64(3)"}- column "properties_group_custom" {- type = "Map(String, String)"- materialized = "mapSort(mapFilter((key, _) -> ((key NOT LIKE '$%') AND (key NOT IN ('token', 'distinct_id', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'gclid', 'gad_source', 'gclsrc', 'dclid', 'gbraid', 'wbraid', 'fbclid', 'msclkid', 'twclid', 'li_fat_id', 'mc_cid', 'igshid', 'ttclid', 'rdt_cid', 'epik', 'qclid', 'sccid', 'irclid', '_kx'))), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"+ column "group3_created_at" {+ type = "DateTime64(3)"}- column "person_properties_map_custom" {- type = "Map(String, String)"- materialized = "mapSort(mapFilter((key, _) -> (key NOT LIKE '$%'), CAST(JSONExtractKeysAndValues(person_properties, 'String'), 'Map(String, String)')))"+ column "group4_created_at" {+ type = "DateTime64(3)"}column "_timestamp" {type = "DateTime"@@ -6534,31 +5235,12 @@ database "posthog" {column "_offset" {type = "UInt64"}- column "_partition" {- type = "UInt64"- }- index "distinct_id_idx" {- expr = "distinct_id"- type = "bloom_filter(0.01)"- granularity = 1- }- index "person_id_idx" {- expr = "person_id"- type = "bloom_filter(0.01)"- granularity = 1- }- index "session_id_idx" {- expr = "session_id"- type = "bloom_filter(0.01)"- granularity = 1- }- index "request_id_idx" {- expr = "request_id"- type = "bloom_filter(0.01)"- granularity = 1+ column "mat_$ai_trace_id" {+ type = "Nullable(String)"+ materialized = "JSONExtract(properties, '$ai_trace_id', 'Nullable(String)')"}- index "inserted_at_idx" {- expr = "inserted_at"+ index "minmax_inserted_at" {+ expr = "coalesce(inserted_at, _timestamp)"type = "minmax"granularity = 1}@@ -6572,6 +5254,16 @@ database "posthog" {type = "bloom_filter"granularity = 1}+ index "properties_group_feature_flags_keys_bf" {+ expr = "mapKeys(properties_group_feature_flags)"+ type = "bloom_filter"+ granularity = 1+ }+ index "properties_group_feature_flags_values_bf" {+ expr = "mapValues(properties_group_feature_flags)"+ type = "bloom_filter"+ granularity = 1+ }index "person_properties_map_custom_keys_bf" {expr = "mapKeys(person_properties_map_custom)"type = "bloom_filter"@@ -6582,411 +5274,581 @@ database "posthog" {type = "bloom_filter"granularity = 1}+ index "properties_group_ai_keys_bf" {+ expr = "mapKeys(properties_group_ai)"+ type = "bloom_filter"+ granularity = 1+ }+ index "properties_group_ai_values_bf" {+ expr = "mapValues(properties_group_ai)"+ type = "bloom_filter"+ granularity = 1+ }+ index "bloom_filter_$ai_trace_id" {+ expr = "`mat_$ai_trace_id`"+ type = "bloom_filter(0.001)"+ granularity = 2+ }+ index "bloom_filter_$ai_session_id" {+ expr = "`mat_$ai_session_id`"+ type = "bloom_filter"+ granularity = 1+ }+ index "minmax_$ai_session_id" {+ expr = "`mat_$ai_session_id`"+ type = "minmax"+ granularity = 1+ }+ index "set_$ai_is_error" {+ expr = "`mat_$ai_is_error`"+ type = "set(7)"+ granularity = 1+ }+ index "bloom_filter_distinct_id" {+ expr = "distinct_id"+ type = "bloom_filter"+ granularity = 1+ }+ index "minmax_sharded_events_timestamp" {+ expr = "timestamp"+ type = "minmax"+ granularity = 1+ }+ index "bloom_filter_$ai_prompt_name" {+ expr = "`mat_$ai_prompt_name`"+ type = "bloom_filter"+ granularity = 1+ }+ index "minmax_$ai_prompt_name" {+ expr = "`mat_$ai_prompt_name`"+ type = "minmax"+ granularity = 1+ }+ index "bloom_filter_$ai_experiment_id" {+ expr = "`mat_$ai_experiment_id`"+ type = "bloom_filter"+ granularity = 1+ }+ index "minmax_$ai_experiment_id" {+ expr = "`mat_$ai_experiment_id`"+ type = "minmax"+ granularity = 1+ }+ index "minmax_$session_id_uuid" {+ expr = "`$session_id_uuid`"+ type = "minmax"+ granularity = 1+ }+ index "bloom_filter_$session_id" {+ expr = "nullIf(nullIf(`$session_id`, ''), 'null')"+ type = "bloom_filter"+ granularity = 1+ }+ index "minmax_$group_0" {+ expr = "`$group_0`"+ type = "minmax"+ granularity = 1+ }+ index "minmax_$group_1" {+ expr = "`$group_1`"+ type = "minmax"+ granularity = 1+ }+ index "minmax_$group_2" {+ expr = "`$group_2`"+ type = "minmax"+ granularity = 1+ }+ index "minmax_$group_3" {+ expr = "`$group_3`"+ type = "minmax"+ granularity = 1+ }+ index "minmax_$group_4" {+ expr = "`$group_4`"+ type = "minmax"+ granularity = 1+ }+ index "minmax_$window_id" {+ expr = "`$window_id`"+ type = "minmax"+ granularity = 1+ }+ index "minmax_$session_id" {+ expr = "`$session_id`"+ type = "minmax"+ granularity = 1+ }+ index "kafka_timestamp_minmax_sharded_events" {+ expr = "_timestamp"+ type = "minmax"+ granularity = 3+ }+ index "is_deleted_idx" {+ expr = "is_deleted"+ type = "minmax"+ granularity = 1+ }+ index "minmax_historical_migration" {+ expr = "historical_migration"+ type = "minmax"+ granularity = 1+ }engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.flag_evaluations"+ zoo_path = "/clickhouse/tables/{shard}/posthog.events"replica_name = "{replica}"version_column = "_timestamp"}}- table "sharded_heatmaps" {- order_by = ["type", "team_id", "toDate(timestamp)", "current_url", "viewport_width"]- partition_by = "toYYYYMM(timestamp)"- ttl = "toDate(timestamp) + toIntervalDay(90)"+ table "sharded_events_json" {+ primary_key = ["team_id", "toDate(timestamp)", "event", "cityHash64(distinct_id)"]+ order_by = ["team_id", "toDate(timestamp)", "event", "cityHash64(distinct_id)", "timestamp", "uuid"]+ partition_by = "clamp(toYYYYMM(timestamp), 202001, 203512)"+ sample_by = "cityHash64(distinct_id)"settings = {- index_granularity = "8192"+ enable_block_number_column = "1"+ enable_block_offset_column = "1"+ index_granularity = "8192"+ map_serialization_version = "with_buckets"+ object_serialization_version = "v3"+ object_shared_data_serialization_version = "map_with_buckets"+ propagate_types_serialization_versions_to_nested_types = "1"+ string_serialization_version = "single_stream"}- column "session_id" {+ column "uuid" {+ type = "UUID"+ }+ column "event" {type = "String"}+ column "properties" {+ type = "JSON(`$browser` LowCardinality(String), `$browser_language` LowCardinality(String), `$browser_version` LowCardinality(String), `$config_defaults` LowCardinality(String), `$device_type` LowCardinality(String), `$exception_functions` Array(String), `$exception_list` Array(JSON(max_dynamic_paths=0, type String, value String)), `$exception_sources` Array(String), `$exception_types` Array(String), `$exception_values` Array(String), `$feature_flags` Map(LowCardinality(String), LowCardinality(String)), `$geoip_city_name` LowCardinality(String), `$geoip_continent_code` LowCardinality(String), `$geoip_continent_name` LowCardinality(String), `$geoip_country_code` LowCardinality(String), `$geoip_country_name` LowCardinality(String), `$geoip_subdivision_1_name` LowCardinality(String), `$geoip_time_zone` LowCardinality(String), `$group_0` String, `$group_1` String, `$group_2` String, `$group_3` String, `$group_4` String, `$lib` LowCardinality(String), `$lib_version` LowCardinality(String), `$mcp_listed_tool_names` Array(String), `$os` LowCardinality(String), `$os_version` LowCardinality(String), `$session_id` String, `$timezone` LowCardinality(String), `$window_id` String)"+ }+ column "temporary_properties" {+ type = "JSON(max_dynamic_paths=32)"+ ttl = "toDateTime(inserted_at) + toIntervalDay(60)"+ }+ column "properties_null_keys" {+ type = "Array(LowCardinality(String))"+ }+ column "temporary_properties_null_keys" {+ type = "Array(LowCardinality(String))"+ ttl = "toDateTime(inserted_at) + toIntervalDay(60)"+ }+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"+ codec = "GCD, Default"+ }column "team_id" {type = "Int64"}column "distinct_id" {type = "String"}- column "timestamp" {- type = "DateTime64(6, 'UTC')"+ column "created_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now()"+ codec = "GCD, Default"}- column "x" {- type = "Int16"+ column "_timestamp" {+ type = "DateTime"+ codec = "T64, Default"}- column "y" {- type = "Int16"+ column "_offset" {+ type = "UInt64"+ codec = "T64, Default"}- column "scale_factor" {- type = "Int16"+ column "elements_chain" {+ type = "String"}- column "viewport_width" {- type = "Int16"+ column "person_id" {+ type = "UUID"}- column "viewport_height" {- type = "Int16"+ column "person_properties" {+ type = "JSON(max_dynamic_paths=256, `$browser` LowCardinality(String), `$browser_language` LowCardinality(String), `$browser_version` LowCardinality(String), `$device_type` LowCardinality(String), `$geoip_city_name` LowCardinality(String), `$geoip_continent_code` LowCardinality(String), `$geoip_continent_name` LowCardinality(String), `$geoip_country_code` LowCardinality(String), `$geoip_country_name` LowCardinality(String), `$geoip_subdivision_1_name` LowCardinality(String), `$geoip_time_zone` LowCardinality(String), `$initial_browser` LowCardinality(String), `$initial_browser_language` LowCardinality(String), `$initial_browser_version` LowCardinality(String), `$initial_device_type` LowCardinality(String), `$initial_geoip_city_name` LowCardinality(String), `$initial_geoip_continent_code` LowCardinality(String), `$initial_geoip_continent_name` LowCardinality(String), `$initial_geoip_country_code` LowCardinality(String), `$initial_geoip_country_name` LowCardinality(String), `$initial_geoip_subdivision_1_name` LowCardinality(String), `$initial_geoip_time_zone` LowCardinality(String), `$initial_os` LowCardinality(String), `$initial_os_version` LowCardinality(String), `$os` LowCardinality(String), `$os_version` LowCardinality(String))"}- column "pointer_target_fixed" {- type = "Bool"+ column "person_properties_null_keys" {+ type = "Array(LowCardinality(String))"}- column "current_url" {+ column "group0_properties" {type = "String"}- column "type" {- type = "LowCardinality(String)"+ column "group1_properties" {+ type = "String"}- column "_timestamp" {- type = "DateTime"+ column "group2_properties" {+ type = "String"}- column "_offset" {- type = "UInt64"+ column "group3_properties" {+ type = "String"}- column "_partition" {- type = "UInt64"+ column "group4_properties" {+ type = "String"}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.heatmaps"- replica_name = "{replica}"+ column "person_created_at" {+ type = "DateTime64(3)"+ codec = "GCD, Default"}- }-- table "sharded_ingestion_warnings" {- order_by = ["team_id", "toHour(timestamp)", "type", "source", "timestamp"]- partition_by = "toYYYYMMDD(timestamp)"- settings = {- index_granularity = "8192"+ column "group0_created_at" {+ type = "DateTime64(3)"}- column "team_id" {- type = "Int64"+ column "group1_created_at" {+ type = "DateTime64(3)"}- column "source" {- type = "LowCardinality(String)"+ column "group2_created_at" {+ type = "DateTime64(3)"}- column "type" {- type = "String"+ column "group3_created_at" {+ type = "DateTime64(3)"}- column "details" {- type = "String"- codec = "ZSTD(3)"+ column "group4_created_at" {+ type = "DateTime64(3)"}- column "timestamp" {- type = "DateTime64(6, 'UTC')"+ column "inserted_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now64()"+ codec = "GCD, Default"}- column "_timestamp" {- type = "DateTime"+ column "person_mode" {+ type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"}- column "_offset" {- type = "UInt64"+ column "consumer_breadcrumbs" {+ type = "Array(String)"+ }+ column "historical_migration" {+ type = "Bool"+ }+ column "total_event_size" {+ type = "UInt32"+ codec = "T64, Default"+ }+ column "captured_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now()"+ codec = "GCD, Default"}column "_partition" {- type = "UInt64"+ type = "UInt64"+ codec = "T64, Default"}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_ingestion_warnings"- replica_name = "{replica}"+ column "elements_chain_href" {+ type = "String"+ materialized = "EXTRACT(elements_chain, '(?::|\")href=\"(.*?)\"')"}- }-- table "sharded_log_entries" {- order_by = ["team_id", "log_source", "log_source_id", "instance_id", "timestamp"]- partition_by = "toYYYYMMDD(timestamp)"- ttl = "toDate(timestamp) + toIntervalDay(90)"- settings = {- index_granularity = "1024"- ttl_only_drop_parts = "1"+ column "elements_chain_texts" {+ type = "Array(String)"+ materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")text=\"(.*?)\"'))"}- column "team_id" {- type = "UInt64"+ column "elements_chain_ids" {+ type = "Array(String)"+ materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")attr_id=\"(.*?)\"'))"}- column "log_source" {- type = "LowCardinality(String)"+ column "elements_chain_elements" {+ type = "Array(Enum8('a'=1, 'button'=2, 'form'=3, 'input'=4, 'select'=5, 'textarea'=6, 'label'=7))"+ materialized = "arrayDistinct(extractAll(elements_chain, '(?:^|;)(a|button|form|input|select|textarea|label)(?:\\\\.|$|:)'))"}- column "log_source_id" {- type = "String"+ index "bloom_filter_distinct_id" {+ expr = "distinct_id"+ type = "bloom_filter"+ granularity = 1}- column "instance_id" {- type = "String"+ index "bloom_filter_uuid" {+ expr = "uuid"+ type = "bloom_filter"+ granularity = 1}- column "timestamp" {- type = "DateTime64(6, 'UTC')"+ index "bloom_filter_person_id" {+ expr = "person_id"+ type = "bloom_filter"+ granularity = 1}- column "level" {- type = "LowCardinality(String)"+ index "minmax_captured_at" {+ expr = "captured_at"+ type = "minmax"+ granularity = 1}- column "message" {- type = "String"+ index "minmax_kafka_timestamp" {+ expr = "_timestamp"+ type = "minmax"+ granularity = 1}- column "_timestamp" {- type = "DateTime"+ index "minmax_inserted_at" {+ expr = "inserted_at"+ type = "minmax"+ granularity = 1}- column "_offset" {- type = "UInt64"+ index "minmax_timestamp" {+ expr = "timestamp"+ type = "minmax"+ granularity = 1+ }+ index "minmax_historical_migration" {+ expr = "historical_migration"+ type = "minmax"+ granularity = 1+ }+ index "minmax_created_at" {+ expr = "created_at"+ type = "minmax"+ granularity = 1}engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_log_entries"+ zoo_path = "/clickhouse/tables/{shard}/posthog.events_json"replica_name = "{replica}"version_column = "_timestamp"}}- table "sharded_performance_events" {- order_by = ["team_id", "toDate(timestamp)", "session_id", "pageview_id", "timestamp"]- partition_by = "toYYYYMM(timestamp)"- ttl = "toDate(timestamp) + toIntervalWeek(3)"+ table "sharded_events_recent" {+ order_by = ["team_id", "toStartOfHour(inserted_at)", "event", "cityHash64(distinct_id)", "cityHash64(uuid)"]+ partition_by = "toStartOfDay(inserted_at)"+ ttl = "toDate(inserted_at) + toIntervalDay(9)"settings = {- index_granularity = "8192"- }- column "uuid" {- type = "UUID"- }- column "session_id" {- type = "String"+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}- column "window_id" {- type = "String"+ column "uuid" {+ type = "UUID"}- column "pageview_id" {+ column "event" {type = "String"}- column "distinct_id" {- type = "String"+ column "properties" {+ type = "String"+ codec = "ZSTD(3)"}column "timestamp" {- type = "DateTime64(3)"- }- column "time_origin" {- type = "DateTime64(3, 'UTC')"- }- column "entry_type" {- type = "LowCardinality(String)"- }- column "name" {- type = "String"+ type = "DateTime64(6, 'UTC')"}column "team_id" {type = "Int64"}- column "current_url" {+ column "distinct_id" {type = "String"}- column "start_time" {- type = "Float64"- }- column "duration" {- type = "Float64"+ column "elements_chain" {+ type = "String"}- column "redirect_start" {- type = "Float64"+ column "created_at" {+ type = "DateTime64(6, 'UTC')"}- column "redirect_end" {- type = "Float64"+ column "person_id" {+ type = "UUID"}- column "worker_start" {- type = "Float64"+ column "person_created_at" {+ type = "DateTime64(3)"}- column "fetch_start" {- type = "Float64"+ column "person_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "domain_lookup_start" {- type = "Float64"+ column "group0_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "domain_lookup_end" {- type = "Float64"+ column "group1_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "connect_start" {- type = "Float64"+ column "group2_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "secure_connection_start" {- type = "Float64"+ column "group3_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "connect_end" {- type = "Float64"+ column "group4_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "request_start" {- type = "Float64"+ column "group0_created_at" {+ type = "DateTime64(3)"}- column "response_start" {- type = "Float64"+ column "group1_created_at" {+ type = "DateTime64(3)"}- column "response_end" {- type = "Float64"+ column "group2_created_at" {+ type = "DateTime64(3)"}- column "decoded_body_size" {- type = "Int64"+ column "group3_created_at" {+ type = "DateTime64(3)"}- column "encoded_body_size" {- type = "Int64"+ column "group4_created_at" {+ type = "DateTime64(3)"}- column "initiator_type" {- type = "LowCardinality(String)"+ column "person_mode" {+ type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"}- column "next_hop_protocol" {- type = "LowCardinality(String)"+ column "historical_migration" {+ type = "Bool"}- column "render_blocking_status" {- type = "LowCardinality(String)"+ column "_timestamp" {+ type = "DateTime"}- column "response_status" {- type = "Int64"+ column "_offset" {+ type = "UInt64"}- column "transfer_size" {- type = "Int64"+ column "inserted_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now64()"}- column "largest_contentful_paint_element" {- type = "String"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_events_recent"+ replica_name = "{replica}"+ version_column = "_timestamp"}- column "largest_contentful_paint_render_time" {- type = "Float64"+ }++ table "sharded_experiment_exposures_preaggregated" {+ order_by = ["team_id", "job_id", "entity_id", "breakdown_value"]+ partition_by = "toYYYYMMDD(expires_at)"+ ttl = "expires_at"+ settings = {+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}- column "largest_contentful_paint_load_time" {- type = "Float64"+ column "team_id" {+ type = "Int64"}- column "largest_contentful_paint_size" {- type = "Float64"+ column "job_id" {+ type = "UUID"}- column "largest_contentful_paint_id" {+ column "entity_id" {type = "String"}- column "largest_contentful_paint_url" {+ column "variant" {type = "String"}- column "dom_complete" {- type = "Float64"- }- column "dom_content_loaded_event" {- type = "Float64"- }- column "dom_interactive" {- type = "Float64"- }- column "load_event_end" {- type = "Float64"- }- column "load_event_start" {- type = "Float64"- }- column "redirect_count" {- type = "Int64"+ column "first_exposure_time" {+ type = "DateTime64(6, 'UTC')"}- column "navigation_type" {- type = "LowCardinality(String)"+ column "last_exposure_time" {+ type = "DateTime64(6, 'UTC')"}- column "unload_event_end" {- type = "Float64"+ column "exposure_event_uuid" {+ type = "UUID"}- column "unload_event_start" {- type = "Float64"+ column "exposure_session_id" {+ type = "String"}- column "_timestamp" {- type = "DateTime"+ column "breakdown_value" {+ type = "Array(String)"}- column "_offset" {- type = "UInt64"+ column "computed_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now()"}- column "_partition" {- type = "UInt64"+ column "expires_at" {+ type = "Date"+ default = "today() + toIntervalDay(7)"}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.performance_events"- replica_name = "{replica}"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.experiment_exposures_preaggregated"+ replica_name = "{replica}"+ version_column = "computed_at"}}- table "sharded_posthog_document_embeddings_buffer" {- order_by = ["inserted_at", "model_name", "cityHash64(document_id)"]- partition_by = "toDate(inserted_at)"- ttl = "inserted_at + toIntervalDay(1)"+ table "sharded_flag_evaluations" {+ order_by = ["team_id", "flag_key", "toDate(timestamp)", "cityHash64(distinct_id)", "cityHash64(uuid)"]+ partition_by = "toYYYYMM(timestamp)"+ ttl = "toDate(timestamp) + toIntervalDay(90)"settings = {index_granularity = "8192"ttl_only_drop_parts = "1"}- column "team_id" {- type = "Int64"+ column "uuid" {+ type = "UUID"}- column "product" {+ column "event" {type = "LowCardinality(String)"}- column "document_type" {- type = "LowCardinality(String)"+ column "properties" {+ type = "String"}- column "model_name" {- type = "LowCardinality(String)"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "rendering" {- type = "LowCardinality(String)"+ column "team_id" {+ type = "Int64"}- column "document_id" {+ column "distinct_id" {type = "String"}- column "timestamp" {- type = "DateTime64(3, 'UTC')"- }- column "inserted_at" {- type = "DateTime64(3, 'UTC')"+ column "created_at" {+ type = "DateTime64(6, 'UTC')"}- column "content" {- type = "String"- default = "''"+ column "person_id" {+ type = "UUID"}- column "metadata" {+ column "person_properties" {type = "String"default = "'{}'"}- column "embedding" {- type = "Array(Float64)"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "_partition" {- type = "UInt64"- }- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_posthog_document_embeddings_buffer"- replica_name = "{replica}"- version_column = "inserted_at"+ column "person_created_at" {+ type = "DateTime64(3)"}- }-- table "sharded_posthog_document_embeddings_text_embedding_3_large_3072" {- order_by = ["team_id", "toDate(timestamp)", "product", "document_type", "rendering", "cityHash64(document_id)"]- partition_by = "toMonday(timestamp)"- ttl = "timestamp + toIntervalMonth(3)"- settings = {- index_granularity = "512"- ttl_only_drop_parts = "1"+ column "inserted_at" {+ type = "DateTime64(6, 'UTC')"+ default = "timestamp"}- column "team_id" {- type = "Int64"+ column "person_mode" {+ type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"}- column "product" {- type = "LowCardinality(String)"+ column "$group_0" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^\"|\"$', '')"+ comment = "column_materializer::$group_0"}- column "document_type" {- type = "LowCardinality(String)"+ column "$group_1" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_1'), '^\"|\"$', '')"+ comment = "column_materializer::$group_1"}- column "rendering" {- type = "LowCardinality(String)"+ column "$group_2" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_2'), '^\"|\"$', '')"+ comment = "column_materializer::$group_2"}- column "document_id" {- type = "String"+ column "$group_3" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_3'), '^\"|\"$', '')"+ comment = "column_materializer::$group_3"}- column "timestamp" {- type = "DateTime64(3, 'UTC')"+ column "$group_4" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_4'), '^\"|\"$', '')"+ comment = "column_materializer::$group_4"}- column "inserted_at" {- type = "DateTime64(3, 'UTC')"+ column "flag_key" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$feature_flag'), '^\"|\"$', '')"+ comment = "column_materializer::properties::$feature_flag"}- column "content" {+ column "response" {+ type = "LowCardinality(String)"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$feature_flag_response'), '^\"|\"$', '')"+ comment = "column_materializer::properties::$feature_flag_response"+ }+ column "session_id" {type = "String"- default = "''"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$session_id'), '^\"|\"$', '')"+ comment = "column_materializer::properties::$session_id"}- column "metadata" {+ column "request_id" {type = "String"- default = "'{}'"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$feature_flag_request_id'), '^\"|\"$', '')"+ comment = "column_materializer::properties::$feature_flag_request_id"}- column "embedding" {- type = "Array(Float64)"+ column "properties_group_custom" {+ type = "Map(String, String)"+ materialized = "mapSort(mapFilter((key, _) -> ((key NOT LIKE '$%') AND (key NOT IN ('token', 'distinct_id', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'gclid', 'gad_source', 'gclsrc', 'dclid', 'gbraid', 'wbraid', 'fbclid', 'msclkid', 'twclid', 'li_fat_id', 'mc_cid', 'igshid', 'ttclid', 'rdt_cid', 'epik', 'qclid', 'sccid', 'irclid', '_kx'))), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"+ }+ column "person_properties_map_custom" {+ type = "Map(String, String)"+ materialized = "mapSort(mapFilter((key, _) -> (key NOT LIKE '$%'), CAST(JSONExtractKeysAndValues(person_properties, 'String'), 'Map(String, String)')))"}column "_timestamp" {type = "DateTime"@@ -6997,70 +5859,100 @@ database "posthog" {column "_partition" {type = "UInt64"}- index "kafka_timestamp_minmax_sharded_posthog_document_embeddings_text_embedding_3_large_3072" {- expr = "_timestamp"+ index "distinct_id_idx" {+ expr = "distinct_id"+ type = "bloom_filter(0.01)"+ granularity = 1+ }+ index "person_id_idx" {+ expr = "person_id"+ type = "bloom_filter(0.01)"+ granularity = 1+ }+ index "session_id_idx" {+ expr = "session_id"+ type = "bloom_filter(0.01)"+ granularity = 1+ }+ index "request_id_idx" {+ expr = "request_id"+ type = "bloom_filter(0.01)"+ granularity = 1+ }+ index "inserted_at_idx" {+ expr = "inserted_at"type = "minmax"- granularity = 3+ granularity = 1}- index "embedding_idx_l2" {- expr = "embedding"- type = "vector_similarity('hnsw', 'L2Distance', 3072)"- granularity = 100000000+ index "properties_group_custom_keys_bf" {+ expr = "mapKeys(properties_group_custom)"+ type = "bloom_filter"+ granularity = 1}- index "embedding_idx_cosine" {- expr = "embedding"- type = "vector_similarity('hnsw', 'cosineDistance', 3072)"- granularity = 100000000+ index "properties_group_custom_values_bf" {+ expr = "mapValues(properties_group_custom)"+ type = "bloom_filter"+ granularity = 1}- constraint "embedding_dimension_check" {- check = "length(embedding) = 3072"+ index "person_properties_map_custom_keys_bf" {+ expr = "mapKeys(person_properties_map_custom)"+ type = "bloom_filter"+ granularity = 1+ }+ index "person_properties_map_custom_values_bf" {+ expr = "mapValues(person_properties_map_custom)"+ type = "bloom_filter"+ granularity = 1}engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_posthog_document_embeddings_text_embedding_3_large_3072"+ zoo_path = "/clickhouse/tables/{shard}/posthog.flag_evaluations"replica_name = "{replica}"- version_column = "inserted_at"+ version_column = "_timestamp"}}- table "sharded_posthog_document_embeddings_text_embedding_3_small_1536" {- order_by = ["team_id", "toDate(timestamp)", "product", "document_type", "rendering", "cityHash64(document_id)"]- partition_by = "toMonday(timestamp)"- ttl = "timestamp + toIntervalMonth(3)"+ table "sharded_heatmaps" {+ order_by = ["type", "team_id", "toDate(timestamp)", "current_url", "viewport_width"]+ partition_by = "toYYYYMM(timestamp)"+ ttl = "toDate(timestamp) + toIntervalDay(90)"settings = {- index_granularity = "512"- ttl_only_drop_parts = "1"+ index_granularity = "8192"+ }+ column "session_id" {+ type = "String"}column "team_id" {type = "Int64"}- column "product" {- type = "LowCardinality(String)"+ column "distinct_id" {+ type = "String"}- column "document_type" {- type = "LowCardinality(String)"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "rendering" {- type = "LowCardinality(String)"+ column "x" {+ type = "Int16"}- column "document_id" {- type = "String"+ column "y" {+ type = "Int16"}- column "timestamp" {- type = "DateTime64(3, 'UTC')"+ column "scale_factor" {+ type = "Int16"}- column "inserted_at" {- type = "DateTime64(3, 'UTC')"+ column "viewport_width" {+ type = "Int16"}- column "content" {- type = "String"- default = "''"+ column "viewport_height" {+ type = "Int16"}- column "metadata" {- type = "String"- default = "'{}'"+ column "pointer_target_fixed" {+ type = "Bool"}- column "embedding" {- type = "Array(Float64)"+ column "current_url" {+ type = "String"+ }+ column "type" {+ type = "LowCardinality(String)"}column "_timestamp" {type = "DateTime"@@ -7071,428 +5963,569 @@ database "posthog" {column "_partition" {type = "UInt64"}- index "kafka_timestamp_minmax_sharded_posthog_document_embeddings_text_embedding_3_small_1536" {- expr = "_timestamp"- type = "minmax"- granularity = 3- }- index "embedding_idx_l2" {- expr = "embedding"- type = "vector_similarity('hnsw', 'L2Distance', 1536)"- granularity = 100000000- }- index "embedding_idx_cosine" {- expr = "embedding"- type = "vector_similarity('hnsw', 'cosineDistance', 1536)"- granularity = 100000000- }- constraint "embedding_dimension_check" {- check = "length(embedding) = 1536"- }- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_posthog_document_embeddings_text_embedding_3_small_1536"- replica_name = "{replica}"- version_column = "inserted_at"+ engine "replicated_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.heatmaps"+ replica_name = "{replica}"}}- table "sharded_preaggregation_results" {- order_by = ["team_id", "job_id", "time_window_start", "breakdown_value"]- partition_by = "toYYYYMM(time_window_start)"- ttl = "expires_at"+ table "sharded_ingestion_warnings" {+ order_by = ["team_id", "toHour(timestamp)", "type", "source", "timestamp"]+ partition_by = "toYYYYMMDD(timestamp)"settings = {index_granularity = "8192"}column "team_id" {type = "Int64"}- column "job_id" {- type = "UUID"+ column "source" {+ type = "LowCardinality(String)"}- column "time_window_start" {+ column "type" {+ type = "String"+ }+ column "details" {+ type = "String"+ codec = "ZSTD(3)"+ }+ column "timestamp" {type = "DateTime64(6, 'UTC')"}- column "expires_at" {- type = "DateTime64(6, 'UTC')"- default = "now() + toIntervalDay(7)"+ column "_timestamp" {+ type = "DateTime"}- column "breakdown_value" {- type = "Array(String)"+ column "_offset" {+ type = "UInt64"}- column "uniq_exact_state" {- type = "AggregateFunction(uniqExact, UUID)"+ column "_partition" {+ type = "UInt64"}- engine "replicated_aggregating_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.preaggregation_results"+ engine "replicated_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_ingestion_warnings"replica_name = "{replica}"}}- table "sharded_precalculated_events" {- order_by = ["team_id", "condition", "date", "distinct_id", "uuid"]- partition_by = "toYYYYMM(date)"+ table "sharded_log_entries" {+ order_by = ["team_id", "log_source", "log_source_id", "instance_id", "timestamp"]+ partition_by = "toYYYYMMDD(timestamp)"+ ttl = "toDate(timestamp) + toIntervalDay(90)"settings = {- index_granularity = "8192"+ index_granularity = "1024"+ ttl_only_drop_parts = "1"}column "team_id" {- type = "Int64"+ type = "UInt64"}- column "date" {- type = "Date"+ column "log_source" {+ type = "LowCardinality(String)"}- column "distinct_id" {+ column "log_source_id" {type = "String"}- column "person_id" {- type = "UUID"- }- column "condition" {+ column "instance_id" {type = "String"}- column "uuid" {- type = "UUID"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "source" {+ column "level" {+ type = "LowCardinality(String)"+ }+ column "message" {type = "String"}column "_timestamp" {- type = "DateTime64(6)"- }- column "_partition" {- type = "UInt64"+ type = "DateTime"}column "_offset" {type = "UInt64"}engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_precalculated_events"+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_log_entries"replica_name = "{replica}"version_column = "_timestamp"}}- table "sharded_precalculated_person_properties" {- order_by = ["team_id", "condition", "distinct_id"]+ table "sharded_performance_events" {+ order_by = ["team_id", "toDate(timestamp)", "session_id", "pageview_id", "timestamp"]+ partition_by = "toYYYYMM(timestamp)"+ ttl = "toDate(timestamp) + toIntervalWeek(3)"settings = {index_granularity = "8192"}- column "team_id" {- type = "Int64"+ column "uuid" {+ type = "UUID"+ }+ column "session_id" {+ type = "String"+ }+ column "window_id" {+ type = "String"+ }+ column "pageview_id" {+ type = "String"}column "distinct_id" {type = "String"}- column "person_id" {- type = "UUID"+ column "timestamp" {+ type = "DateTime64(3)"}- column "condition" {+ column "time_origin" {+ type = "DateTime64(3, 'UTC')"+ }+ column "entry_type" {+ type = "LowCardinality(String)"+ }+ column "name" {type = "String"}- column "matches" {- type = "Bool"+ column "team_id" {+ type = "Int64"}- column "source" {+ column "current_url" {type = "String"}- column "_timestamp" {- type = "DateTime64(6)"+ column "start_time" {+ type = "Float64"}- column "_offset" {- type = "UInt64"+ column "duration" {+ type = "Float64"}- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_precalculated_person_properties"- replica_name = "{replica}"- version_column = "_timestamp"+ column "redirect_start" {+ type = "Float64"}- }-- table "sharded_query_log_archive_old" {- order_by = ["team_id", "event_date", "event_time", "query_id"]- partition_by = "toYYYYMM(event_date)"- settings = {- index_granularity = "8192"+ column "redirect_end" {+ type = "Float64"}- column "hostname" {+ column "worker_start" {+ type = "Float64"+ }+ column "fetch_start" {+ type = "Float64"+ }+ column "domain_lookup_start" {+ type = "Float64"+ }+ column "domain_lookup_end" {+ type = "Float64"+ }+ column "connect_start" {+ type = "Float64"+ }+ column "secure_connection_start" {+ type = "Float64"+ }+ column "connect_end" {+ type = "Float64"+ }+ column "request_start" {+ type = "Float64"+ }+ column "response_start" {+ type = "Float64"+ }+ column "response_end" {+ type = "Float64"+ }+ column "decoded_body_size" {+ type = "Int64"+ }+ column "encoded_body_size" {+ type = "Int64"+ }+ column "initiator_type" {type = "LowCardinality(String)"}- column "user" {+ column "next_hop_protocol" {type = "LowCardinality(String)"}- column "query_id" {+ column "render_blocking_status" {+ type = "LowCardinality(String)"+ }+ column "response_status" {+ type = "Int64"+ }+ column "transfer_size" {+ type = "Int64"+ }+ column "largest_contentful_paint_element" {type = "String"}- column "initial_query_id" {+ column "largest_contentful_paint_render_time" {+ type = "Float64"+ }+ column "largest_contentful_paint_load_time" {+ type = "Float64"+ }+ column "largest_contentful_paint_size" {+ type = "Float64"+ }+ column "largest_contentful_paint_id" {type = "String"}- column "is_initial_query" {- type = "UInt8"+ column "largest_contentful_paint_url" {+ type = "String"}- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"+ column "dom_complete" {+ type = "Float64"}- column "event_date" {- type = "Date"+ column "dom_content_loaded_event" {+ type = "Float64"}- column "event_time" {- type = "DateTime"+ column "dom_interactive" {+ type = "Float64"}- column "event_time_microseconds" {- type = "DateTime64(6)"+ column "load_event_end" {+ type = "Float64"}- column "query_start_time" {- type = "DateTime"+ column "load_event_start" {+ type = "Float64"}- column "query_start_time_microseconds" {- type = "DateTime64(6)"+ column "redirect_count" {+ type = "Int64"}- column "query_duration_ms" {- type = "UInt64"+ column "navigation_type" {+ type = "LowCardinality(String)"}- column "read_rows" {- type = "UInt64"+ column "unload_event_end" {+ type = "Float64"}- column "read_bytes" {- type = "UInt64"+ column "unload_event_start" {+ type = "Float64"}- column "written_rows" {- type = "UInt64"+ column "_timestamp" {+ type = "DateTime"}- column "written_bytes" {+ column "_offset" {type = "UInt64"}- column "result_rows" {+ column "_partition" {type = "UInt64"}- column "result_bytes" {- type = "UInt64"+ engine "replicated_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.performance_events"+ replica_name = "{replica}"}- column "memory_usage" {- type = "UInt64"+ }++ table "sharded_posthog_document_embeddings_buffer" {+ order_by = ["inserted_at", "model_name", "cityHash64(document_id)"]+ partition_by = "toDate(inserted_at)"+ ttl = "inserted_at + toIntervalDay(1)"+ settings = {+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}- column "peak_threads_usage" {- type = "UInt64"+ column "team_id" {+ type = "Int64"}- column "current_database" {+ column "product" {type = "LowCardinality(String)"}- column "query" {- type = "String"+ column "document_type" {+ type = "LowCardinality(String)"}- column "formatted_query" {+ column "model_name" {+ type = "LowCardinality(String)"+ }+ column "rendering" {+ type = "LowCardinality(String)"+ }+ column "document_id" {type = "String"}- column "normalized_query_hash" {+ column "timestamp" {+ type = "DateTime64(3, 'UTC')"+ }+ column "inserted_at" {+ type = "DateTime64(3, 'UTC')"+ }+ column "content" {+ type = "String"+ default = "''"+ }+ column "metadata" {+ type = "String"+ default = "'{}'"+ }+ column "embedding" {+ type = "Array(Float64)"+ }+ column "_timestamp" {+ type = "DateTime"+ }+ column "_offset" {+ type = "UInt64"+ }+ column "_partition" {type = "UInt64"}- column "query_kind" {- type = "LowCardinality(String)"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_posthog_document_embeddings_buffer"+ replica_name = "{replica}"+ version_column = "inserted_at"}- column "exception_code" {- type = "Int32"+ }++ table "sharded_posthog_document_embeddings_text_embedding_3_large_3072" {+ order_by = ["team_id", "toDate(timestamp)", "product", "document_type", "rendering", "cityHash64(document_id)"]+ partition_by = "toMonday(timestamp)"+ ttl = "timestamp + toIntervalMonth(3)"+ settings = {+ index_granularity = "512"+ ttl_only_drop_parts = "1"}- column "exception_name" {- type = "String"- alias = "errorCodeToName(exception_code)"+ column "team_id" {+ type = "Int64"}- column "exception" {- type = "String"+ column "product" {+ type = "LowCardinality(String)"}- column "stack_trace" {- type = "String"+ column "document_type" {+ type = "LowCardinality(String)"}- column "ProfileEvents_RealTimeMicroseconds" {- type = "Int64"+ column "rendering" {+ type = "LowCardinality(String)"}- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "Int64"+ column "document_id" {+ type = "String"}- column "ProfileEvents_S3Clients" {- type = "Int64"+ column "timestamp" {+ type = "DateTime64(3, 'UTC')"}- column "ProfileEvents_S3DeleteObjects" {- type = "Int64"+ column "inserted_at" {+ type = "DateTime64(3, 'UTC')"}- column "ProfileEvents_S3CopyObject" {- type = "Int64"+ column "content" {+ type = "String"+ default = "''"}- column "ProfileEvents_S3ListObjects" {- type = "Int64"+ column "metadata" {+ type = "String"+ default = "'{}'"}- column "ProfileEvents_S3HeadObject" {- type = "Int64"+ column "embedding" {+ type = "Array(Float64)"}- column "ProfileEvents_S3GetObjectAttributes" {- type = "Int64"+ column "_timestamp" {+ type = "DateTime"}- column "ProfileEvents_S3CreateMultipartUpload" {- type = "Int64"+ column "_offset" {+ type = "UInt64"}- column "ProfileEvents_S3UploadPartCopy" {- type = "Int64"+ column "_partition" {+ type = "UInt64"}- column "ProfileEvents_S3UploadPart" {- type = "Int64"+ index "kafka_timestamp_minmax_sharded_posthog_document_embeddings_text_embedding_3_large_3072" {+ expr = "_timestamp"+ type = "minmax"+ granularity = 3}- column "ProfileEvents_S3AbortMultipartUpload" {- type = "Int64"+ index "embedding_idx_l2" {+ expr = "embedding"+ type = "vector_similarity('hnsw', 'L2Distance', 3072)"+ granularity = 100000000}- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "Int64"+ index "embedding_idx_cosine" {+ expr = "embedding"+ type = "vector_similarity('hnsw', 'cosineDistance', 3072)"+ granularity = 100000000}- column "ProfileEvents_S3PutObject" {- type = "Int64"+ constraint "embedding_dimension_check" {+ check = "length(embedding) = 3072"}- column "ProfileEvents_S3GetObject" {- type = "Int64"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_posthog_document_embeddings_text_embedding_3_large_3072"+ replica_name = "{replica}"+ version_column = "inserted_at"}- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "Int64"+ }++ table "sharded_posthog_document_embeddings_text_embedding_3_small_1536" {+ order_by = ["team_id", "toDate(timestamp)", "product", "document_type", "rendering", "cityHash64(document_id)"]+ partition_by = "toMonday(timestamp)"+ ttl = "timestamp + toIntervalMonth(3)"+ settings = {+ index_granularity = "512"+ ttl_only_drop_parts = "1"}- column "ProfileEvents_WriteBufferFromS3Bytes" {+ column "team_id" {type = "Int64"}- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- column "lc_workflow" {+ column "product" {type = "LowCardinality(String)"}- column "lc_kind" {+ column "document_type" {type = "LowCardinality(String)"}- column "lc_id" {- type = "String"- }- column "lc_route_id" {- type = "String"- }- column "lc_access_method" {+ column "rendering" {type = "LowCardinality(String)"}- column "lc_api_key_label" {- type = "String"- }- column "lc_api_key_mask" {+ column "document_id" {type = "String"}- column "lc_query_type" {- type = "LowCardinality(String)"- }- column "lc_product" {- type = "LowCardinality(String)"+ column "timestamp" {+ type = "DateTime64(3, 'UTC')"}- column "lc_chargeable" {- type = "Bool"+ column "inserted_at" {+ type = "DateTime64(3, 'UTC')"}- column "lc_name" {- type = "String"+ column "content" {+ type = "String"+ default = "''"}- column "lc_request_name" {- type = "String"+ column "metadata" {+ type = "String"+ default = "'{}'"}- column "lc_client_query_id" {- type = "String"+ column "embedding" {+ type = "Array(Float64)"}- column "lc_org_id" {- type = "String"+ column "_timestamp" {+ type = "DateTime"}- column "team_id" {- type = "Int64"+ column "_offset" {+ type = "UInt64"}- column "lc_user_id" {- type = "Int64"+ column "_partition" {+ type = "UInt64"}- column "lc_is_impersonated" {- type = "Bool"+ index "kafka_timestamp_minmax_sharded_posthog_document_embeddings_text_embedding_3_small_1536" {+ expr = "_timestamp"+ type = "minmax"+ granularity = 3}- column "lc_session_id" {- type = "String"+ index "embedding_idx_l2" {+ expr = "embedding"+ type = "vector_similarity('hnsw', 'L2Distance', 1536)"+ granularity = 100000000}- column "lc_dashboard_id" {- type = "Int64"+ index "embedding_idx_cosine" {+ expr = "embedding"+ type = "vector_similarity('hnsw', 'cosineDistance', 1536)"+ granularity = 100000000}- column "lc_insight_id" {- type = "Int64"+ constraint "embedding_dimension_check" {+ check = "length(embedding) = 1536"}- column "lc_cohort_id" {- type = "Int64"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_posthog_document_embeddings_text_embedding_3_small_1536"+ replica_name = "{replica}"+ version_column = "inserted_at"}- column "lc_batch_export_id" {- type = "String"+ }++ table "sharded_preaggregation_results" {+ order_by = ["team_id", "job_id", "time_window_start", "breakdown_value"]+ partition_by = "toYYYYMM(time_window_start)"+ ttl = "expires_at"+ settings = {+ index_granularity = "8192"}- column "lc_experiment_id" {+ column "team_id" {type = "Int64"}- column "lc_experiment_feature_flag_key" {- type = "String"+ column "job_id" {+ type = "UUID"}- column "lc_alert_config_id" {- type = "String"+ column "time_window_start" {+ type = "DateTime64(6, 'UTC')"}- column "lc_feature" {- type = "LowCardinality(String)"+ column "expires_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now() + toIntervalDay(7)"}- column "lc_table_id" {- type = "String"+ column "breakdown_value" {+ type = "Array(String)"}- column "lc_warehouse_query" {- type = "Bool"+ column "uniq_exact_state" {+ type = "AggregateFunction(uniqExact, UUID)"}- column "lc_person_on_events_mode" {- type = "LowCardinality(String)"+ engine "replicated_aggregating_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.preaggregation_results"+ replica_name = "{replica}"}- column "lc_service_name" {- type = "String"+ }++ table "sharded_precalculated_events" {+ order_by = ["team_id", "condition", "date", "distinct_id", "uuid"]+ partition_by = "toYYYYMM(date)"+ settings = {+ index_granularity = "8192"}- column "lc_workload" {- type = "LowCardinality(String)"+ column "team_id" {+ type = "Int64"}- column "lc_query__kind" {- type = "LowCardinality(String)"+ column "date" {+ type = "Date"}- column "lc_query__query" {+ column "distinct_id" {type = "String"}- column "lc_query" {- type = "String"+ column "person_id" {+ type = "UUID"}- column "lc_temporal__workflow_namespace" {+ column "condition" {type = "String"}- column "lc_temporal__workflow_type" {- type = "String"+ column "uuid" {+ type = "UUID"}- column "lc_temporal__workflow_id" {+ column "source" {type = "String"}- column "lc_temporal__workflow_run_id" {- type = "String"+ column "_timestamp" {+ type = "DateTime64(6)"}- column "lc_temporal__activity_type" {- type = "String"+ column "_partition" {+ type = "UInt64"}- column "lc_temporal__activity_id" {- type = "String"+ column "_offset" {+ type = "UInt64"}- column "lc_temporal__attempt" {+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_precalculated_events"+ replica_name = "{replica}"+ version_column = "_timestamp"+ }+ }++ table "sharded_precalculated_person_properties" {+ order_by = ["team_id", "condition", "distinct_id"]+ settings = {+ index_granularity = "8192"+ }+ column "team_id" {type = "Int64"}- column "lc_dagster__job_name" {+ column "distinct_id" {type = "String"}- column "lc_dagster__run_id" {- type = "String"+ column "person_id" {+ type = "UUID"}- column "lc_dagster__owner" {+ column "condition" {type = "String"}- column "lc_modifiers" {+ column "matches" {+ type = "Bool"+ }+ column "source" {type = "String"}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_query_log_archive"- replica_name = "{replica}"+ column "_timestamp" {+ type = "DateTime64(6)"+ }+ column "_offset" {+ type = "UInt64"+ }+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_precalculated_person_properties"+ replica_name = "{replica}"+ version_column = "_timestamp"}}@@ -9771,107 +8804,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -11219,140 +10151,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/local-multi/ingestion_events.hcl b/posthog/clickhouse/hcl/golden/local-multi/ingestion_events.hclindex eef4ba6874e5..e965ccb569ea 100644--- a/posthog/clickhouse/hcl/golden/local-multi/ingestion_events.hcl+++ b/posthog/clickhouse/hcl/golden/local-multi/ingestion_events.hcl@@ -584,395 +584,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "writable_events_json" {column "uuid" {type = "UUID"diff --git a/posthog/clickhouse/hcl/golden/local-multi/ingestion_medium.hcl b/posthog/clickhouse/hcl/golden/local-multi/ingestion_medium.hclindex a1ad8a03ad06..f4e62218b6be 100644--- a/posthog/clickhouse/hcl/golden/local-multi/ingestion_medium.hcl+++ b/posthog/clickhouse/hcl/golden/local-multi/ingestion_medium.hcl@@ -967,395 +967,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "writable_app_metrics2" {column "team_id" {type = "Int64"diff --git a/posthog/clickhouse/hcl/golden/local-multi/ingestion_small.hcl b/posthog/clickhouse/hcl/golden/local-multi/ingestion_small.hclindex 034d4c6d8134..d2984f31ae52 100644--- a/posthog/clickhouse/hcl/golden/local-multi/ingestion_small.hcl+++ b/posthog/clickhouse/hcl/golden/local-multi/ingestion_small.hcl@@ -1098,395 +1098,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "writable_app_metrics" {column "team_id" {type = "Int64"diff --git a/posthog/clickhouse/hcl/golden/local-multi/logs.hcl b/posthog/clickhouse/hcl/golden/local-multi/logs.hclindex 94aa8c616e86..f762adedfd2b 100644--- a/posthog/clickhouse/hcl/golden/local-multi/logs.hcl+++ b/posthog/clickhouse/hcl/golden/local-multi/logs.hcl@@ -3157,395 +3157,6 @@ SQL}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "trace_attributes" {order_by = ["team_id", "attribute_type", "time_bucket", "resource_fingerprint", "attribute_key", "attribute_value"]partition_by = "toDate(original_expiry_time_bucket)"diff --git a/posthog/clickhouse/hcl/golden/local-multi/ops.hcl b/posthog/clickhouse/hcl/golden/local-multi/ops.hclindex ee3eba57039c..4ec3ba8e45f1 100644--- a/posthog/clickhouse/hcl/golden/local-multi/ops.hcl+++ b/posthog/clickhouse/hcl/golden/local-multi/ops.hcl@@ -441,114 +441,7 @@ database "posthog" {}}- table "query_log_archive_buffer" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "buffer" {- database = "posthog"- table = "sharded_query_log_archive"- num_layers = 16- min_time = 10- max_time = 60- min_rows = 10000- max_rows = 1000000- min_bytes = 10000000- max_bytes = 100000000- }- }-- table "query_log_archive_v3" {+ table "query_log_archive_v3_buffer" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"}@@ -843,826 +736,70 @@ database "posthog" {column "lc_dagster__owner" {type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-- table "query_log_archive_v3_buffer" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- engine "buffer" {- database = "posthog"- table = "sharded_query_log_archive_v3"- num_layers = 16- min_time = 10- max_time = 60- min_rows = 10000- max_rows = 1000000- min_bytes = 10000000- max_bytes = 100000000- }- }-- table "sharded_query_log_archive" {- order_by = ["team_id", "event_date", "event_time", "query_id"]- partition_by = "toYYYYMM(event_date)"- settings = {- index_granularity = "8192"- object_serialization_version = "v3"- object_shared_data_serialization_version = "map_with_buckets"- }- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- column "exception_name" {- type = "String"- alias = "errorCodeToName(exception_code)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "Int64"- alias = "ProfileEvents['RealTimeMicroseconds']"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "Int64"- alias = "ProfileEvents['OSCPUVirtualTimeMicroseconds']"- }- column "ProfileEvents_S3Clients" {- type = "Int64"- alias = "ProfileEvents['S3Clients']"- }- column "ProfileEvents_S3DeleteObjects" {- type = "Int64"- alias = "ProfileEvents['S3DeleteObjects']"- }- column "ProfileEvents_S3CopyObject" {- type = "Int64"- alias = "ProfileEvents['S3CopyObject']"- }- column "ProfileEvents_S3ListObjects" {- type = "Int64"- alias = "ProfileEvents['S3ListObjects']"- }- column "ProfileEvents_S3HeadObject" {- type = "Int64"- alias = "ProfileEvents['S3HeadObject']"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "Int64"- alias = "ProfileEvents['S3GetObjectAttributes']"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3CreateMultipartUpload']"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "Int64"- alias = "ProfileEvents['S3UploadPartCopy']"- }- column "ProfileEvents_S3UploadPart" {- type = "Int64"- alias = "ProfileEvents['S3UploadPart']"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3AbortMultipartUpload']"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3CompleteMultipartUpload']"- }- column "ProfileEvents_S3PutObject" {- type = "Int64"- alias = "ProfileEvents['S3PutObject']"- }- column "ProfileEvents_S3GetObject" {- type = "Int64"- alias = "ProfileEvents['S3GetObject']"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "Int64"- alias = "ProfileEvents['ReadBufferFromS3Bytes']"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "Int64"- alias = "ProfileEvents['WriteBufferFromS3Bytes']"- }- column "lc_workflow" {- type = "LowCardinality(String)"- alias = "log_comment.workflow"- }- column "lc_kind" {- type = "LowCardinality(String)"- alias = "log_comment.kind"- }- column "lc_id" {- type = "String"- alias = "CAST(log_comment.id, 'String')"- }- column "lc_route_id" {- type = "String"- alias = "CAST(log_comment.route_id, 'String')"- }- column "lc_access_method" {- type = "LowCardinality(String)"- alias = "log_comment.access_method"- }- column "lc_api_key_label" {- type = "String"- alias = "CAST(log_comment.api_key_label, 'String')"- }- column "lc_api_key_mask" {- type = "String"- alias = "CAST(log_comment.api_key_mask, 'String')"- }- column "lc_query_type" {- type = "LowCardinality(String)"- alias = "log_comment.query_type"- }- column "lc_product" {- type = "LowCardinality(String)"- alias = "log_comment.product"- }- column "lc_chargeable" {- type = "Bool"- alias = "log_comment.chargeable"- }- column "lc_name" {- type = "String"- alias = "CAST(log_comment.name, 'String')"- }- column "lc_request_name" {- type = "String"- alias = "CAST(log_comment.request_name, 'String')"- }- column "lc_client_query_id" {- type = "String"- alias = "CAST(log_comment.client_query_id, 'String')"- }- column "lc_org_id" {- type = "String"- alias = "CAST(log_comment.org_id, 'String')"- }- column "lc_user_id" {- type = "Int64"- alias = "log_comment.user_id"- }- column "lc_is_impersonated" {- type = "Bool"- alias = "log_comment.is_impersonated"- }- column "lc_session_id" {- type = "String"- alias = "CAST(log_comment.session_id, 'String')"- }- column "lc_dashboard_id" {- type = "Int64"- alias = "log_comment.dashboard_id"- }- column "lc_insight_id" {- type = "Int64"- alias = "log_comment.insight_id"- }- column "lc_cohort_id" {- type = "Int64"- alias = "log_comment.cohort_id"- }- column "lc_batch_export_id" {- type = "String"- alias = "CAST(log_comment.batch_export_id, 'String')"- }- column "lc_experiment_id" {- type = "Int64"- alias = "log_comment.experiment_id"- }- column "lc_experiment_feature_flag_key" {- type = "String"- alias = "CAST(log_comment.experiment_feature_flag_key, 'String')"- }- column "lc_alert_config_id" {- type = "String"- alias = "CAST(log_comment.alert_config_id, 'String')"- }- column "lc_feature" {- type = "LowCardinality(String)"- alias = "log_comment.feature"- }- column "lc_table_id" {- type = "String"- alias = "CAST(log_comment.table_id, 'String')"- }- column "lc_warehouse_query" {- type = "Bool"- alias = "log_comment.warehouse_query"- }- column "lc_person_on_events_mode" {- type = "LowCardinality(String)"- alias = "log_comment.person_on_events_mode"- }- column "lc_service_name" {- type = "String"- alias = "CAST(log_comment.service_name, 'String')"- }- column "lc_workload" {- type = "LowCardinality(String)"- alias = "log_comment.workload"+ column "lc_experiment_name" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_query__kind" {- type = "LowCardinality(String)"- alias = "if(JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'kind'), JSONExtractString(toString(log_comment), 'query', 'kind'))"+ column "lc_experiment_metric_name" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_query__query" {- type = "String"- alias = "multiIf(NOT is_initial_query, '', JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'), JSONExtractString(toString(log_comment), 'query', 'query'))"+ column "lc_experiment_execution_path" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_query" {- type = "String"- alias = "if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), '')"+ column "lc_experiment_metric_type" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_temporal__workflow_namespace" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_namespace`, 'String')"+ column "lc_experiment_funnel_order_type" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_temporal__workflow_type" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_type`, 'String')"+ column "lc_experiment_exposures_path" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_temporal__workflow_id" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_id`, 'String')"+ column "lc_experiment_metric_events_path" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_temporal__workflow_run_id" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_run_id`, 'String')"+ column "lc_experiment_query_surface" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_temporal__activity_type" {- type = "String"- alias = "CAST(log_comment.`temporal.activity_type`, 'String')"+ column "lc_experiment_precompute_table" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_temporal__activity_id" {- type = "String"- alias = "CAST(log_comment.`temporal.activity_id`, 'String')"+ column "lc_experiment_query_group_id" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_temporal__attempt" {- type = "Int64"- alias = "log_comment.`temporal.attempt`"+ column "lc_experiment_precompute_skip_reason" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "lc_dagster__job_name" {- type = "String"- alias = "CAST(log_comment.`dagster.job_name`, 'String')"+ column "lc_experiment_scan_date_from" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_dagster__run_id" {- type = "String"- alias = "CAST(log_comment.`dagster.run_id`, 'String')"+ column "lc_experiment_scan_date_to" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_dagster__owner" {- type = "String"- alias = "CAST(log_comment.`dagster.tags.owner`, 'String')"+ column "lc_precompute_window_start" {+ type = "SimpleAggregateFunction(max, String)"}- column "lc_modifiers" {- type = "String"- alias = "if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), '')"+ column "lc_precompute_window_end" {+ type = "SimpleAggregateFunction(max, String)"}column "lc_plan_fingerprint" {- type = "String"- alias = "ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), '')"+ type = "SimpleAggregateFunction(max, String)"}column "lc_estimated_rows" {- type = "Int64"- alias = "ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0)"+ type = "SimpleAggregateFunction(max, Int64)"}column "lc_estimated_bytes" {- type = "Int64"- alias = "ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0)"+ type = "SimpleAggregateFunction(max, Int64)"}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.sharded_query_log_archive"- replica_name = "{replica}-{shard}"+ engine "buffer" {+ database = "posthog"+ table = "sharded_query_log_archive_v3"+ num_layers = 16+ min_time = 10+ max_time = 60+ min_rows = 10000+ max_rows = 1000000+ min_bytes = 10000000+ max_bytes = 100000000}}@@ -2126,107 +1263,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -2583,140 +1619,6 @@ database "posthog" {}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/local-multi/sessions.hcl b/posthog/clickhouse/hcl/golden/local-multi/sessions.hclindex d9133d56a084..06828c0d5dbf 100644--- a/posthog/clickhouse/hcl/golden/local-multi/sessions.hcl+++ b/posthog/clickhouse/hcl/golden/local-multi/sessions.hcl@@ -388,496 +388,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -1234,140 +744,6 @@ database "posthog" {}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/local-single/all.hcl b/posthog/clickhouse/hcl/golden/local-single/all.hclindex 2b90f0dc2704..0267100a0d06 100644--- a/posthog/clickhouse/hcl/golden/local-single/all.hcl+++ b/posthog/clickhouse/hcl/golden/local-single/all.hcl@@ -9196,1224 +9196,1113 @@ SQL}}- table "query_log_archive_buffer" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"+ table "query_log_archive_v3_buffer" {+ column "initial_query_start_time" {+ type = "DateTime64(6, 'UTC')"}- column "query_id" {- type = "String"+ column "team_id" {+ type = "Int64"}column "initial_query_id" {type = "String"}column "is_initial_query" {- type = "UInt8"+ type = "SimpleAggregateFunction(max, UInt8)"}- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"+ column "hostname" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "event_date" {- type = "Date"+ column "user" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "event_time" {- type = "DateTime"+ column "type" {+ type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"}column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}column "query_duration_ms" {- type = "UInt64"+ type = "SimpleAggregateFunction(max, UInt64)"}column "read_rows" {- type = "UInt64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "read_bytes" {- type = "UInt64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "written_rows" {- type = "UInt64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "written_bytes" {- type = "UInt64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "result_rows" {- type = "UInt64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "result_bytes" {- type = "UInt64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "memory_usage" {- type = "UInt64"+ type = "SimpleAggregateFunction(max, UInt64)"+ }+ column "memory_usage_sum" {+ type = "SimpleAggregateFunction(sum, UInt64)"}column "peak_threads_usage" {- type = "UInt64"+ type = "SimpleAggregateFunction(sum, UInt64)"+ }+ column "execution_count" {+ type = "SimpleAggregateFunction(sum, UInt64)"}column "current_database" {- type = "LowCardinality(String)"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "query" {- type = "String"- }- column "formatted_query" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "normalized_query_hash" {- type = "UInt64"+ type = "SimpleAggregateFunction(max, UInt64)"}- column "query_kind" {- type = "LowCardinality(String)"+ column "query_kind_by_root" {+ type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"+ }+ column "tables" {+ type = "SimpleAggregateFunction(max, Array(String))"}column "exception_code" {- type = "Int32"+ type = "SimpleAggregateFunction(max, Int32)"}column "exception" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "buffer" {- database = "posthog"- table = "sharded_query_log_archive"- num_layers = 16- min_time = 10- max_time = 60- min_rows = 10000- max_rows = 1000000- min_bytes = 10000000- max_bytes = 100000000- }- }-- table "query_log_archive_v2" {- order_by = ["team_id", "event_date", "event_time", "query_id"]- partition_by = "toYYYYMM(event_date)"- settings = {- index_granularity = "8192"- }- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"+ type = "SimpleAggregateFunction(max, String)"}- column "peak_threads_usage" {- type = "UInt64"+ column "ProfileEvents_SelectedRows" {+ type = "SimpleAggregateFunction(sum, UInt64)"}- column "current_database" {- type = "LowCardinality(String)"+ column "ProfileEvents_SelectedBytes" {+ type = "SimpleAggregateFunction(sum, UInt64)"}- column "query" {- type = "String"+ column "ProfileEvents_RealTimeMicroseconds" {+ type = "SimpleAggregateFunction(sum, UInt64)"}- column "formatted_query" {- type = "String"+ column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {+ type = "SimpleAggregateFunction(sum, UInt64)"}- column "normalized_query_hash" {- type = "UInt64"+ column "ProfileEvents_UserTimeMicroseconds" {+ type = "SimpleAggregateFunction(sum, UInt64)"}- column "query_kind" {- type = "LowCardinality(String)"+ column "ProfileEvents_SystemTimeMicroseconds" {+ type = "SimpleAggregateFunction(sum, UInt64)"}- column "exception_code" {- type = "Int32"+ column "ProfileEvents_SelectedParts" {+ type = "SimpleAggregateFunction(sum, UInt64)"}- column "exception_name" {- type = "String"- alias = "errorCodeToName(exception_code)"+ column "ProfileEvents_SelectedMarks" {+ type = "SimpleAggregateFunction(sum, UInt64)"}- column "exception" {- type = "String"+ column "ProfileEvents_NetworkReceiveBytes" {+ type = "SimpleAggregateFunction(sum, UInt64)"}- column "stack_trace" {- type = "String"+ column "ProfileEvents_NetworkSendBytes" {+ type = "SimpleAggregateFunction(sum, UInt64)"}- column "ProfileEvents_RealTimeMicroseconds" {- type = "Int64"+ column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {+ type = "SimpleAggregateFunction(sum, UInt64)"}- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "Int64"+ column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3Clients" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3DeleteObjects" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3CopyObject" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3ListObjects" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3HeadObject" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3GetObjectAttributes" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3CreateMultipartUpload" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3UploadPartCopy" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3UploadPart" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3AbortMultipartUpload" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3CompleteMultipartUpload" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3PutObject" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_S3GetObject" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "Int64"+ type = "SimpleAggregateFunction(sum, UInt64)"}- column "ProfileEvents" {- type = "Map(String, UInt64)"+ column "lc_org_id" {+ type = "SimpleAggregateFunction(max, String)"+ }+ column "lc_user_id" {+ type = "SimpleAggregateFunction(max, Int64)"+ }+ column "lc_session_id" {+ type = "SimpleAggregateFunction(max, String)"+ }+ column "lc_is_impersonated" {+ type = "SimpleAggregateFunction(max, Bool)"}column "lc_workflow" {- type = "LowCardinality(String)"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_kind" {- type = "LowCardinality(String)"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_id" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_route_id" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_access_method" {- type = "LowCardinality(String)"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_api_key_label" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_api_key_mask" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_query_type" {- type = "LowCardinality(String)"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_product" {- type = "LowCardinality(String)"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_chargeable" {- type = "Bool"+ type = "SimpleAggregateFunction(max, Bool)"}column "lc_name" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_request_name" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_client_query_id" {- type = "String"- }- column "lc_org_id" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "lc_user_id" {- type = "Int64"- }- column "lc_is_impersonated" {- type = "Bool"- }- column "lc_session_id" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_dashboard_id" {- type = "Int64"+ type = "SimpleAggregateFunction(max, Int64)"}column "lc_insight_id" {- type = "Int64"+ type = "SimpleAggregateFunction(max, Int64)"}column "lc_cohort_id" {- type = "Int64"+ type = "SimpleAggregateFunction(max, Int64)"}column "lc_batch_export_id" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_experiment_id" {- type = "Int64"+ type = "SimpleAggregateFunction(max, Int64)"}column "lc_experiment_feature_flag_key" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_alert_config_id" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_feature" {- type = "LowCardinality(String)"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_table_id" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_warehouse_query" {- type = "Bool"+ type = "SimpleAggregateFunction(max, Bool)"}column "lc_person_on_events_mode" {- type = "LowCardinality(String)"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_service_name" {- type = "String"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_workload" {- type = "LowCardinality(String)"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_query__kind" {- type = "LowCardinality(String)"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_query__query" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_query" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"+ }+ column "lc_modifiers" {+ type = "SimpleAggregateFunction(max, String)"}column "lc_temporal__workflow_namespace" {- type = "String"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_temporal__workflow_type" {- type = "String"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_temporal__workflow_id" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_temporal__workflow_run_id" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_temporal__activity_type" {- type = "String"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_temporal__activity_id" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_temporal__attempt" {- type = "Int64"+ type = "SimpleAggregateFunction(max, Int64)"}column "lc_dagster__job_name" {- type = "String"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}column "lc_dagster__run_id" {- type = "String"+ type = "SimpleAggregateFunction(max, String)"}column "lc_dagster__owner" {- type = "String"- }- column "lc_modifiers" {- type = "String"+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.query_log_archive_new"- replica_name = "{replica}-{shard}"+ column "lc_experiment_name" {+ type = "SimpleAggregateFunction(max, String)"}- }-- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"+ column "lc_experiment_metric_name" {+ type = "SimpleAggregateFunction(max, String)"}- column "team_id" {- type = "Int64"+ column "lc_experiment_execution_path" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "initial_query_id" {- type = "String"+ column "lc_experiment_metric_type" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"+ column "lc_experiment_funnel_order_type" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "hostname" {+ column "lc_experiment_exposures_path" {type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "user" {+ column "lc_experiment_metric_events_path" {type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"+ column "lc_experiment_query_surface" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"+ column "lc_experiment_precompute_table" {+ type = "SimpleAggregateFunction(max, String)"}- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"+ column "lc_experiment_query_group_id" {+ type = "SimpleAggregateFunction(max, String)"}- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "lc_experiment_precompute_skip_reason" {+ type = "SimpleAggregateFunction(max, LowCardinality(String))"}- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "lc_experiment_scan_date_from" {+ type = "SimpleAggregateFunction(max, String)"}- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "lc_experiment_scan_date_to" {+ type = "SimpleAggregateFunction(max, String)"}- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "lc_precompute_window_start" {+ type = "SimpleAggregateFunction(max, String)"}- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "lc_precompute_window_end" {+ type = "SimpleAggregateFunction(max, String)"}- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "lc_plan_fingerprint" {+ type = "SimpleAggregateFunction(max, String)"}- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"+ column "lc_estimated_rows" {+ type = "SimpleAggregateFunction(max, Int64)"}- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "lc_estimated_bytes" {+ type = "SimpleAggregateFunction(max, Int64)"}- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"+ engine "buffer" {+ database = "posthog"+ table = "sharded_query_log_archive_v3"+ num_layers = 16+ min_time = 10+ max_time = 60+ min_rows = 10000+ max_rows = 1000000+ min_bytes = 10000000+ max_bytes = 100000000}- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"+ }++ table "raw_error_tracking_fingerprint_issue_state" {+ order_by = ["team_id", "fingerprint"]+ settings = {+ index_granularity = "512"}- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "team_id" {+ type = "Int64"}- column "query" {- type = "SimpleAggregateFunction(max, String)"+ column "fingerprint" {+ type = "String"}- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"+ column "issue_id" {+ type = "UUID"}- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"+ column "issue_name" {+ type = "Nullable(String)"}- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"+ column "issue_description" {+ type = "Nullable(String)"}- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"+ column "issue_status" {+ type = "String"}- column "exception" {- type = "SimpleAggregateFunction(max, String)"+ column "issue_severity" {+ type = "Nullable(String)"}- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"+ column "assigned_user_id" {+ type = "Nullable(Int64)"}- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "assigned_role_id" {+ type = "Nullable(UUID)"}- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "first_seen" {+ type = "DateTime64(3, 'UTC')"}- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "is_deleted" {+ type = "Int8"}- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "version" {+ type = "Int64"}- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "_timestamp" {+ type = "DateTime"}- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "_offset" {+ type = "UInt64"}- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "_partition" {+ type = "UInt64"}- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"+ index "kafka_timestamp_minmax_raw_error_tracking_fingerprint_issue_state" {+ expr = "_timestamp"+ type = "minmax"+ granularity = 3}- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/noshard/posthog.raw_error_tracking_fingerprint_issue_state"+ replica_name = "{replica}-{shard}"+ version_column = "version"}- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ }++ table "raw_sessions" {+ column "team_id" {+ type = "Int64"}- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "session_id_v7" {+ type = "UInt128"}- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "distinct_id" {+ type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "min_timestamp" {+ type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "max_timestamp" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "max_inserted_at" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "urls" {+ type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"}- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "entry_url" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "end_url" {+ type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "last_external_click_url" {+ type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "initial_browser" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "initial_browser_version" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "initial_os" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "initial_os_version" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "initial_device_type" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "initial_viewport_width" {+ type = "AggregateFunction(argMin, Int64, DateTime64(6, 'UTC'))"}- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "initial_viewport_height" {+ type = "AggregateFunction(argMin, Int64, DateTime64(6, 'UTC'))"}- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "initial_geoip_country_code" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_geoip_subdivision_1_code" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "initial_geoip_subdivision_1_name" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_geoip_subdivision_city_name" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"+ column "initial_geoip_time_zone" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "initial_referring_domain" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "initial_utm_source" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_utm_campaign" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_utm_medium" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "initial_utm_term" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_utm_content" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_gclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "initial_gad_source" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "initial_gclsrc" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"+ column "initial_dclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_gbraid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_wbraid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_fbclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "initial_msclkid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "initial_twclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "initial_li_fat_id" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_mc_cid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "initial_igshid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_ttclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_epik" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "initial_qclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"+ column "initial_sccid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"+ column "initial__kx" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "initial_irclid" {+ type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "pageview_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "pageview_uniq" {+ type = "AggregateFunction(uniq, Nullable(UUID))"}- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "autocapture_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"+ column "autocapture_uniq" {+ type = "AggregateFunction(uniq, Nullable(UUID))"}- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"+ column "screen_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"+ column "screen_uniq" {+ type = "AggregateFunction(uniq, Nullable(UUID))"}- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "maybe_has_session_replay" {+ type = "SimpleAggregateFunction(max, Bool)"}- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "page_screen_autocapture_uniq_up_to" {+ type = "AggregateFunction(uniqUpTo(1), Nullable(UUID))"}- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"+ column "vitals_lcp" {+ type = "AggregateFunction(argMin, Nullable(Float64), DateTime64(6, 'UTC'))"}- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"+ engine "distributed" {+ cluster_name = "posthog"+ remote_database = "posthog"+ remote_table = "sharded_raw_sessions"+ sharding_key = "cityHash64(session_id_v7)"}- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ }++ table "raw_sessions_v3" {+ column "team_id" {+ type = "Int64"}- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"+ column "session_id_v7" {+ type = "UInt128"}- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"+ column "session_timestamp" {+ type = "DateTime64(3)"+ materialized = "fromUnixTimestamp64Milli(toUInt64(bitShiftRight(session_id_v7, 80)))"}- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "distinct_id" {+ type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"}- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"+ column "distinct_ids" {+ type = "AggregateFunction(groupUniqArray, String)"}- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "min_timestamp" {+ type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"}- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"+ column "max_timestamp" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"+ column "max_inserted_at" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "urls" {+ type = "SimpleAggregateFunction(groupUniqArrayArray(2000), Array(String))"}- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "entry_url" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "end_url" {+ type = "AggregateFunction(argMax, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "last_external_click_url" {+ type = "AggregateFunction(argMax, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "browser" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "browser_version" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"+ column "os" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"+ column "os_version" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "device_type" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"+ column "viewport_width" {+ type = "AggregateFunction(argMin, Nullable(Int64), DateTime64(6, 'UTC'))"}- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"+ column "viewport_height" {+ type = "AggregateFunction(argMin, Nullable(Int64), DateTime64(6, 'UTC'))"}- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"+ column "geoip_country_code" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"+ column "geoip_subdivision_1_code" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"+ column "geoip_subdivision_1_name" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"+ column "geoip_subdivision_city_name" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"+ column "geoip_time_zone" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "query_id" {- type = "String"+ column "entry_referring_domain" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "event_time" {- type = "DateTime('UTC')"+ column "entry_utm_source" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "event_date" {- type = "Date"+ column "entry_utm_campaign" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "query_start_time" {- type = "DateTime('UTC')"+ column "entry_utm_medium" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"+ column "entry_utm_term" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "query_kind" {- type = "LowCardinality(String)"+ column "entry_utm_content" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "formatted_query" {- type = "String"+ column "entry_gclid" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "query_shape" {- type = "String"+ column "entry_gad_source" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "hogql_shape" {- type = "String"+ column "entry_fbclid" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "exception_name" {- type = "String"+ column "entry_has_gclid" {+ type = "AggregateFunction(argMin, Bool, DateTime64(6, 'UTC'))"}- column "ProfileEvents" {- type = "Map(String, UInt64)"+ column "entry_has_fbclid" {+ type = "AggregateFunction(argMin, Bool, DateTime64(6, 'UTC'))"}- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"+ column "entry_ad_ids_map" {+ type = "AggregateFunction(argMin, Map(String, String), DateTime64(6, 'UTC'))"}- }-- table "query_log_archive_v3_buffer" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"+ column "entry_ad_ids_set" {+ type = "AggregateFunction(argMin, Array(String), DateTime64(6, 'UTC'))"}- column "team_id" {- type = "Int64"+ column "entry_channel_type_properties" {+ type = "AggregateFunction(argMin, Tuple(Nullable(String), Nullable(String), Nullable(String), Nullable(String), Bool, Bool, Nullable(String)), DateTime64(6, 'UTC'))"}- column "initial_query_id" {- type = "String"+ column "pageview_uniq" {+ type = "AggregateFunction(uniqExact, Nullable(UUID))"}- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"+ column "autocapture_uniq" {+ type = "AggregateFunction(uniqExact, Nullable(UUID))"}- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "screen_uniq" {+ type = "AggregateFunction(uniqExact, Nullable(UUID))"}- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "page_screen_uniq_up_to" {+ type = "AggregateFunction(uniqUpTo(1), Nullable(UUID))"}- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"+ column "has_autocapture" {+ type = "SimpleAggregateFunction(max, Bool)"}- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"+ column "flag_key_values" {+ type = "SimpleAggregateFunction(groupUniqArrayArray(10000), Array(String))"}- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"+ column "flag_keys" {+ type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"}- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "event_names" {+ type = "SimpleAggregateFunction(groupUniqArrayArray(2000), Array(String))"}- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "hosts" {+ type = "SimpleAggregateFunction(groupUniqArrayArray(100), Array(String))"}- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "emails" {+ type = "SimpleAggregateFunction(groupUniqArrayArray(10), Array(String))"}- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "has_replay_events" {+ type = "SimpleAggregateFunction(max, Bool)"}- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ engine "distributed" {+ cluster_name = "posthog"+ remote_database = "posthog"+ remote_table = "sharded_raw_sessions_v3"+ sharding_key = "cityHash64(session_id_v7)"}- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ }++ table "session_replay_embeddings" {+ column "session_id" {+ type = "String"}- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"+ column "team_id" {+ type = "Int64"}- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "embeddings" {+ type = "Array(Float32)"}- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "generation_timestamp" {+ type = "DateTime64(6, 'UTC')"+ default = "now('UTC')"}- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "source_type" {+ type = "LowCardinality(String)"}- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "input" {+ type = "String"}- column "query" {- type = "SimpleAggregateFunction(max, String)"+ engine "distributed" {+ cluster_name = "posthog"+ remote_database = "posthog"+ remote_table = "sharded_session_replay_embeddings"+ sharding_key = "sipHash64(session_id)"}- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"+ }++ table "session_replay_events" {+ column "session_id" {+ type = "String"}- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"+ column "team_id" {+ type = "Int64"}- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"+ column "distinct_id" {+ type = "String"}- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"+ column "min_first_timestamp" {+ type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"}- column "exception" {- type = "SimpleAggregateFunction(max, String)"+ column "max_last_timestamp" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"+ column "first_url" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "click_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "keypress_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "mouse_activity_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "active_milliseconds" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "console_log_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "console_warn_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "console_error_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "size" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "message_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "event_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "_timestamp" {+ type = "SimpleAggregateFunction(max, DateTime)"}- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "snapshot_source" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "all_urls" {+ type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"}- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "snapshot_library" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "block_first_timestamps" {+ type = "SimpleAggregateFunction(groupArrayArray, Array(DateTime64(6, 'UTC')))"}- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "block_last_timestamps" {+ type = "SimpleAggregateFunction(groupArrayArray, Array(DateTime64(6, 'UTC')))"}- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "block_urls" {+ type = "SimpleAggregateFunction(groupArrayArray, Array(String))"}- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "retention_period_days" {+ type = "SimpleAggregateFunction(max, Nullable(Int64))"}- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "is_deleted" {+ type = "SimpleAggregateFunction(max, UInt8)"+ default = "0"}- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "ai_tags_fixed" {+ type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"}- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "ai_tags_freeform" {+ type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"}- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "ai_highlighted" {+ type = "SimpleAggregateFunction(max, UInt8)"+ default = "0"}- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "surfacing_score" {+ type = "SimpleAggregateFunction(max, Nullable(Float32))"}- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "snapshot_mode_v2" {+ type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"}- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"+ engine "distributed" {+ cluster_name = "posthog"+ remote_database = "posthog"+ remote_table = "sharded_session_replay_events"+ sharding_key = "sipHash64(distinct_id)"}- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ }++ table "session_replay_features" {+ column "session_id" {+ type = "String"}- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "team_id" {+ type = "Int64"}- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"+ column "distinct_id" {+ type = "String"}- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "min_first_timestamp" {+ type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"}- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"+ column "max_last_timestamp" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"+ column "event_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "mouse_position_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "mouse_sum_x" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"+ column "mouse_sum_x_squared" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"+ column "mouse_sum_y" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "mouse_sum_y_squared" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"+ column "mouse_distance_traveled" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"+ column "mouse_direction_change_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "mouse_velocity_sum" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "mouse_velocity_sum_of_squares" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"+ column "mouse_velocity_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"+ column "scroll_event_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"+ column "total_scroll_magnitude" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"+ column "scroll_direction_reversal_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "rapid_scroll_reversal_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "scroll_to_top_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "click_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"+ column "keypress_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"+ column "mouse_activity_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"+ column "rage_click_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"+ column "dead_click_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "backspace_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"+ column "inter_action_gap_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"+ column "inter_action_gap_sum_ms" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "inter_action_gap_sum_of_squares_ms" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "max_idle_gap_ms" {+ type = "SimpleAggregateFunction(max, Float64)"}- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "long_idle_gap_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "quick_back_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"+ column "page_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"+ column "unique_url_count" {+ type = "AggregateFunction(uniqCombined(12), String)"}- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"+ column "login_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "signup_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "checkout_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"+ column "cart_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "billing_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "settings_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "account_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "error_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "not_found_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "admin_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"+ column "dashboard_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"+ column "onboarding_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"+ column "cancel_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"+ column "refund_path_visit_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"+ column "console_error_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"+ column "console_error_after_click_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"+ column "console_warn_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"+ column "network_request_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"+ column "network_failed_request_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"+ column "network_4xx_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- engine "buffer" {- database = "posthog"- table = "sharded_query_log_archive_v3"- num_layers = 16- min_time = 10- max_time = 60- min_rows = 10000- max_rows = 1000000- min_bytes = 10000000- max_bytes = 100000000+ column "network_5xx_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- }-- table "raw_error_tracking_fingerprint_issue_state" {- order_by = ["team_id", "fingerprint"]- settings = {- index_granularity = "512"+ column "network_request_duration_sum" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "team_id" {- type = "Int64"+ column "network_request_duration_sum_of_squares" {+ type = "SimpleAggregateFunction(sum, Float64)"}- column "fingerprint" {- type = "String"+ column "network_request_duration_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "issue_id" {- type = "UUID"+ column "mutation_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "issue_name" {- type = "Nullable(String)"+ column "viewport_resize_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "issue_description" {- type = "Nullable(String)"+ column "touch_event_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "issue_status" {- type = "String"+ column "max_scroll_y" {+ type = "SimpleAggregateFunction(max, Float64)"}- column "issue_severity" {- type = "Nullable(String)"+ column "unique_click_target_count" {+ type = "AggregateFunction(uniqCombined(12), Int64)"}- column "assigned_user_id" {- type = "Nullable(Int64)"+ column "unique_form_field_count" {+ type = "AggregateFunction(uniqCombined(12), Int64)"}- column "assigned_role_id" {- type = "Nullable(UUID)"+ column "text_selection_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "first_seen" {- type = "DateTime64(3, 'UTC')"+ column "selection_copy_count" {+ type = "SimpleAggregateFunction(sum, Int64)"}column "is_deleted" {- type = "Int8"- }- column "version" {- type = "Int64"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "_partition" {- type = "UInt64"- }- index "kafka_timestamp_minmax_raw_error_tracking_fingerprint_issue_state" {- expr = "_timestamp"- type = "minmax"- granularity = 3+ type = "SimpleAggregateFunction(max, UInt8)"+ default = "0"}- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.raw_error_tracking_fingerprint_issue_state"- replica_name = "{replica}-{shard}"- version_column = "version"+ engine "distributed" {+ cluster_name = "aux"+ remote_database = "posthog"+ remote_table = "sharded_session_replay_features"+ sharding_key = "sipHash64(session_id)"}}- table "raw_sessions" {+ table "sessions" {+ column "session_id" {+ type = "String"+ }column "team_id" {type = "Int64"}- column "session_id_v7" {- type = "UInt128"- }column "distinct_id" {- type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"+ type = "SimpleAggregateFunction(any, String)"}column "min_timestamp" {type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"@@ -10421,57 +10310,15 @@ SQLcolumn "max_timestamp" {type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "max_inserted_at" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }column "urls" {type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"}column "entry_url" {type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "end_url" {- type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"- }- column "last_external_click_url" {+ column "exit_url" {type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"}- column "initial_browser" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_browser_version" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_os" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_os_version" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_device_type" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_viewport_width" {- type = "AggregateFunction(argMin, Int64, DateTime64(6, 'UTC'))"- }- column "initial_viewport_height" {- type = "AggregateFunction(argMin, Int64, DateTime64(6, 'UTC'))"- }- column "initial_geoip_country_code" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_geoip_subdivision_1_code" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_geoip_subdivision_1_name" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_geoip_subdivision_city_name" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_geoip_time_zone" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }column "initial_referring_domain" {type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}@@ -10538,2767 +10385,1513 @@ SQLcolumn "initial_sccid" {type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"}- column "initial__kx" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"- }- column "initial_irclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "event_count_map" {+ type = "SimpleAggregateFunction(sumMap, Map(String, Int64))"}column "pageview_count" {type = "SimpleAggregateFunction(sum, Int64)"}- column "pageview_uniq" {- type = "AggregateFunction(uniq, Nullable(UUID))"- }column "autocapture_count" {type = "SimpleAggregateFunction(sum, Int64)"}- column "autocapture_uniq" {- type = "AggregateFunction(uniq, Nullable(UUID))"- }- column "screen_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "screen_uniq" {- type = "AggregateFunction(uniq, Nullable(UUID))"+ engine "distributed" {+ cluster_name = "posthog"+ remote_database = "posthog"+ remote_table = "sharded_sessions"+ sharding_key = "sipHash64(session_id)"}- column "maybe_has_session_replay" {- type = "SimpleAggregateFunction(max, Bool)"+ }++ table "sharded_ai_events" {+ order_by = ["team_id", "trace_id", "timestamp"]+ partition_by = "toYYYYMM(drop_date)"+ ttl = "drop_date"+ settings = {+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}- column "page_screen_autocapture_uniq_up_to" {- type = "AggregateFunction(uniqUpTo(1), Nullable(UUID))"+ column "uuid" {+ type = "UUID"}- column "vitals_lcp" {- type = "AggregateFunction(argMin, Nullable(Float64), DateTime64(6, 'UTC'))"+ column "event" {+ type = "LowCardinality(String)"}- engine "distributed" {- cluster_name = "posthog"- remote_database = "posthog"- remote_table = "sharded_raw_sessions"- sharding_key = "cityHash64(session_id_v7)"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"}- }-- table "raw_sessions_v3" {column "team_id" {type = "Int64"}- column "session_id_v7" {- type = "UInt128"- }- column "session_timestamp" {- type = "DateTime64(3)"- materialized = "fromUnixTimestamp64Milli(toUInt64(bitShiftRight(session_id_v7, 80)))"- }column "distinct_id" {- type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"+ type = "String"}- column "distinct_ids" {- type = "AggregateFunction(groupUniqArray, String)"+ column "person_id" {+ type = "UUID"}- column "min_timestamp" {- type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"+ column "properties" {+ type = "String"}- column "max_timestamp" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"+ column "retention_days" {+ type = "Int16"+ default = "30"}- column "max_inserted_at" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"+ column "drop_date" {+ type = "Date"+ materialized = "toDate(timestamp) + toIntervalDay(retention_days)"}- column "urls" {- type = "SimpleAggregateFunction(groupUniqArrayArray(2000), Array(String))"+ column "trace_id" {+ type = "String"}- column "entry_url" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "session_id" {+ type = "Nullable(String)"}- column "end_url" {- type = "AggregateFunction(argMax, Nullable(String), DateTime64(6, 'UTC'))"+ column "parent_id" {+ type = "Nullable(String)"}- column "last_external_click_url" {- type = "AggregateFunction(argMax, Nullable(String), DateTime64(6, 'UTC'))"+ column "span_id" {+ type = "Nullable(String)"}- column "browser" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "span_type" {+ type = "LowCardinality(Nullable(String))"}- column "browser_version" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "generation_id" {+ type = "Nullable(String)"}- column "os" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "experiment_id" {+ type = "Nullable(String)"}- column "os_version" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "span_name" {+ type = "Nullable(String)"}- column "device_type" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "trace_name" {+ type = "Nullable(String)"}- column "viewport_width" {- type = "AggregateFunction(argMin, Nullable(Int64), DateTime64(6, 'UTC'))"+ column "prompt_name" {+ type = "Nullable(String)"}- column "viewport_height" {- type = "AggregateFunction(argMin, Nullable(Int64), DateTime64(6, 'UTC'))"+ column "model" {+ type = "LowCardinality(Nullable(String))"}- column "geoip_country_code" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "provider" {+ type = "LowCardinality(Nullable(String))"}- column "geoip_subdivision_1_code" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "framework" {+ type = "LowCardinality(Nullable(String))"}- column "geoip_subdivision_1_name" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "total_tokens" {+ type = "Nullable(Int64)"}- column "geoip_subdivision_city_name" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "input_tokens" {+ type = "Nullable(Int64)"}- column "geoip_time_zone" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "output_tokens" {+ type = "Nullable(Int64)"}- column "entry_referring_domain" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "text_input_tokens" {+ type = "Nullable(Int64)"}- column "entry_utm_source" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "text_output_tokens" {+ type = "Nullable(Int64)"}- column "entry_utm_campaign" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "image_input_tokens" {+ type = "Nullable(Int64)"}- column "entry_utm_medium" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "image_output_tokens" {+ type = "Nullable(Int64)"}- column "entry_utm_term" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "audio_input_tokens" {+ type = "Nullable(Int64)"}- column "entry_utm_content" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "audio_output_tokens" {+ type = "Nullable(Int64)"}- column "entry_gclid" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "video_input_tokens" {+ type = "Nullable(Int64)"}- column "entry_gad_source" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "video_output_tokens" {+ type = "Nullable(Int64)"}- column "entry_fbclid" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "reasoning_tokens" {+ type = "Nullable(Int64)"}- column "entry_has_gclid" {- type = "AggregateFunction(argMin, Bool, DateTime64(6, 'UTC'))"+ column "cache_read_input_tokens" {+ type = "Nullable(Int64)"}- column "entry_has_fbclid" {- type = "AggregateFunction(argMin, Bool, DateTime64(6, 'UTC'))"+ column "cache_creation_input_tokens" {+ type = "Nullable(Int64)"}- column "entry_ad_ids_map" {- type = "AggregateFunction(argMin, Map(String, String), DateTime64(6, 'UTC'))"+ column "web_search_count" {+ type = "Nullable(Int64)"}- column "entry_ad_ids_set" {- type = "AggregateFunction(argMin, Array(String), DateTime64(6, 'UTC'))"+ column "input_cost_usd" {+ type = "Nullable(Float64)"}- column "entry_channel_type_properties" {- type = "AggregateFunction(argMin, Tuple(Nullable(String), Nullable(String), Nullable(String), Nullable(String), Bool, Bool, Nullable(String)), DateTime64(6, 'UTC'))"+ column "output_cost_usd" {+ type = "Nullable(Float64)"}- column "pageview_uniq" {- type = "AggregateFunction(uniqExact, Nullable(UUID))"+ column "total_cost_usd" {+ type = "Nullable(Float64)"}- column "autocapture_uniq" {- type = "AggregateFunction(uniqExact, Nullable(UUID))"+ column "request_cost_usd" {+ type = "Nullable(Float64)"}- column "screen_uniq" {- type = "AggregateFunction(uniqExact, Nullable(UUID))"+ column "web_search_cost_usd" {+ type = "Nullable(Float64)"}- column "page_screen_uniq_up_to" {- type = "AggregateFunction(uniqUpTo(1), Nullable(UUID))"+ column "audio_cost_usd" {+ type = "Nullable(Float64)"}- column "has_autocapture" {- type = "SimpleAggregateFunction(max, Bool)"+ column "image_cost_usd" {+ type = "Nullable(Float64)"}- column "flag_key_values" {- type = "SimpleAggregateFunction(groupUniqArrayArray(10000), Array(String))"+ column "video_cost_usd" {+ type = "Nullable(Float64)"}- column "flag_keys" {- type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"+ column "latency" {+ type = "Nullable(Float64)"}- column "event_names" {- type = "SimpleAggregateFunction(groupUniqArrayArray(2000), Array(String))"+ column "time_to_first_token" {+ type = "Nullable(Float64)"}- column "hosts" {- type = "SimpleAggregateFunction(groupUniqArrayArray(100), Array(String))"+ column "is_error" {+ type = "UInt8"}- column "emails" {- type = "SimpleAggregateFunction(groupUniqArrayArray(10), Array(String))"+ column "error" {+ type = "Nullable(String)"}- column "has_replay_events" {- type = "SimpleAggregateFunction(max, Bool)"+ column "error_type" {+ type = "LowCardinality(Nullable(String))"}- engine "distributed" {- cluster_name = "posthog"- remote_database = "posthog"- remote_table = "sharded_raw_sessions_v3"- sharding_key = "cityHash64(session_id_v7)"+ column "error_normalized" {+ type = "Nullable(String)"}- }-- table "session_replay_embeddings" {- column "session_id" {- type = "String"+ column "input" {+ type = "Nullable(String)"}- column "team_id" {- type = "Int64"+ column "output" {+ type = "Nullable(String)"}- column "embeddings" {- type = "Array(Float32)"+ column "output_choices" {+ type = "Nullable(String)"}- column "generation_timestamp" {- type = "DateTime64(6, 'UTC')"- default = "now('UTC')"+ column "input_state" {+ type = "Nullable(String)"}- column "source_type" {- type = "LowCardinality(String)"+ column "output_state" {+ type = "Nullable(String)"}- column "input" {- type = "String"+ column "tools" {+ type = "Nullable(String)"}- engine "distributed" {- cluster_name = "posthog"- remote_database = "posthog"- remote_table = "sharded_session_replay_embeddings"- sharding_key = "sipHash64(session_id)"- }- }-- table "session_replay_events" {- column "session_id" {- type = "String"- }- column "team_id" {- type = "Int64"+ column "_timestamp" {+ type = "DateTime"}- column "distinct_id" {- type = "String"+ column "_offset" {+ type = "UInt64"}- column "min_first_timestamp" {- type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"+ column "_partition" {+ type = "UInt64"}- column "max_last_timestamp" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"+ index "idx_trace_id" {+ expr = "trace_id"+ type = "bloom_filter(0.001)"+ granularity = 1}- column "first_url" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ index "idx_session_id" {+ expr = "session_id"+ type = "bloom_filter(0.01)"+ granularity = 1}- column "click_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ index "idx_parent_id" {+ expr = "parent_id"+ type = "bloom_filter(0.01)"+ granularity = 1}- column "keypress_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ index "idx_span_id" {+ expr = "span_id"+ type = "bloom_filter(0.01)"+ granularity = 1}- column "mouse_activity_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ index "idx_prompt_name" {+ expr = "prompt_name"+ type = "bloom_filter(0.01)"+ granularity = 1}- column "active_milliseconds" {- type = "SimpleAggregateFunction(sum, Int64)"+ index "idx_model" {+ expr = "model"+ type = "bloom_filter(0.01)"+ granularity = 1}- column "console_log_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ index "idx_experiment_id" {+ expr = "experiment_id"+ type = "bloom_filter(0.01)"+ granularity = 1}- column "console_warn_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ index "idx_event" {+ expr = "event"+ type = "set(20)"+ granularity = 1}- column "console_error_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ index "idx_is_error" {+ expr = "is_error"+ type = "set(2)"+ granularity = 1}- column "size" {- type = "SimpleAggregateFunction(sum, Int64)"+ index "idx_provider" {+ expr = "provider"+ type = "set(50)"+ granularity = 1}- column "message_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ engine "replicated_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.ai_events"+ replica_name = "{replica}"}- column "event_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ }++ table "sharded_app_metrics" {+ order_by = ["team_id", "plugin_config_id", "job_id", "category", "toStartOfHour(timestamp)", "error_type", "error_uuid"]+ partition_by = "toYYYYMM(timestamp)"+ settings = {+ index_granularity = "8192"}- column "_timestamp" {- type = "SimpleAggregateFunction(max, DateTime)"+ column "team_id" {+ type = "Int64"}- column "snapshot_source" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "all_urls" {- type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"+ column "plugin_config_id" {+ type = "Int64"}- column "snapshot_library" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "category" {+ type = "LowCardinality(String)"}- column "block_first_timestamps" {- type = "SimpleAggregateFunction(groupArrayArray, Array(DateTime64(6, 'UTC')))"+ column "job_id" {+ type = "String"}- column "block_last_timestamps" {- type = "SimpleAggregateFunction(groupArrayArray, Array(DateTime64(6, 'UTC')))"+ column "successes" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "block_urls" {- type = "SimpleAggregateFunction(groupArrayArray, Array(String))"+ column "successes_on_retry" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "retention_period_days" {- type = "SimpleAggregateFunction(max, Nullable(Int64))"+ column "failures" {+ type = "SimpleAggregateFunction(sum, Int64)"}- column "is_deleted" {- type = "SimpleAggregateFunction(max, UInt8)"- default = "0"+ column "error_uuid" {+ type = "UUID"}- column "ai_tags_fixed" {- type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"+ column "error_type" {+ type = "String"}- column "ai_tags_freeform" {- type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"+ column "error_details" {+ type = "String"+ codec = "ZSTD(3)"}- column "ai_highlighted" {- type = "SimpleAggregateFunction(max, UInt8)"- default = "0"+ column "_timestamp" {+ type = "DateTime"}- column "surfacing_score" {- type = "SimpleAggregateFunction(max, Nullable(Float32))"+ column "_offset" {+ type = "UInt64"}- column "snapshot_mode_v2" {- type = "AggregateFunction(argMin, Nullable(String), DateTime64(6, 'UTC'))"+ column "_partition" {+ type = "UInt64"}- engine "distributed" {- cluster_name = "posthog"- remote_database = "posthog"- remote_table = "sharded_session_replay_events"- sharding_key = "sipHash64(distinct_id)"+ engine "replicated_aggregating_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_app_metrics"+ replica_name = "{replica}"}}- table "session_replay_features" {- column "session_id" {- type = "String"+ table "sharded_app_metrics2" {+ order_by = ["team_id", "app_source", "app_source_id", "instance_id", "toStartOfHour(timestamp)", "metric_kind", "metric_name"]+ partition_by = "toYYYYMM(timestamp)"+ ttl = "toDate(timestamp) + toIntervalDay(90)"+ settings = {+ index_granularity = "8192"}column "team_id" {type = "Int64"}- column "distinct_id" {+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"+ }+ column "app_source" {+ type = "LowCardinality(String)"+ }+ column "app_source_id" {type = "String"}- column "min_first_timestamp" {- type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"+ column "instance_id" {+ type = "String"}- column "max_last_timestamp" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"+ column "metric_kind" {+ type = "LowCardinality(String)"}- column "event_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "metric_name" {+ type = "LowCardinality(String)"}- column "mouse_position_count" {+ column "count" {type = "SimpleAggregateFunction(sum, Int64)"}- column "mouse_sum_x" {- type = "SimpleAggregateFunction(sum, Float64)"+ column "_timestamp" {+ type = "DateTime"}- column "mouse_sum_x_squared" {- type = "SimpleAggregateFunction(sum, Float64)"+ column "_offset" {+ type = "UInt64"}- column "mouse_sum_y" {- type = "SimpleAggregateFunction(sum, Float64)"+ column "_partition" {+ type = "UInt64"}- column "mouse_sum_y_squared" {- type = "SimpleAggregateFunction(sum, Float64)"+ engine "replicated_aggregating_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_app_metrics2"+ replica_name = "{replica}"}- column "mouse_distance_traveled" {- type = "SimpleAggregateFunction(sum, Float64)"+ }++ table "sharded_billing_usage_records" {+ order_by = ["team_id", "toDate(timestamp)", "producer_id", "usage_key", "record_id"]+ partition_by = "toYYYYMM(timestamp)"+ settings = {+ index_granularity = "8192"}- column "mouse_direction_change_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "schema_version" {+ type = "UInt8"}- column "mouse_velocity_sum" {- type = "SimpleAggregateFunction(sum, Float64)"+ column "record_id" {+ type = "String"}- column "mouse_velocity_sum_of_squares" {- type = "SimpleAggregateFunction(sum, Float64)"+ column "producer_id" {+ type = "LowCardinality(String)"}- column "mouse_velocity_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "team_id" {+ type = "Int64"}- column "scroll_event_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "organization_id" {+ type = "UUID"}- column "total_scroll_magnitude" {- type = "SimpleAggregateFunction(sum, Float64)"+ column "usage_key" {+ type = "LowCardinality(String)"}- column "scroll_direction_reversal_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "unit" {+ type = "LowCardinality(String)"}- column "rapid_scroll_reversal_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "quantity" {+ type = "Int64"}- column "scroll_to_top_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "click_count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "keypress_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "inserted_at" {+ type = "DateTime64(6, 'UTC')"}- column "mouse_activity_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "_timestamp" {+ type = "DateTime"}- column "rage_click_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "_offset" {+ type = "UInt64"}- column "dead_click_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "_partition" {+ type = "UInt64"}- column "backspace_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_billing_usage_records"+ replica_name = "{replica}"+ version_column = "inserted_at"}- column "inter_action_gap_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ }++ table "sharded_conversion_goal_attributed_preaggregated" {+ order_by = ["team_id", "job_id", "person_id", "conversion_timestamp", "touchpoint_timestamp"]+ partition_by = "toYYYYMMDD(expires_at)"+ ttl = "expires_at"+ settings = {+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}- column "inter_action_gap_sum_ms" {- type = "SimpleAggregateFunction(sum, Float64)"+ column "team_id" {+ type = "Int64"}- column "inter_action_gap_sum_of_squares_ms" {- type = "SimpleAggregateFunction(sum, Float64)"+ column "job_id" {+ type = "UUID"}- column "max_idle_gap_ms" {- type = "SimpleAggregateFunction(max, Float64)"+ column "person_id" {+ type = "UUID"}- column "long_idle_gap_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "conversion_timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "quick_back_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "conversion_value" {+ type = "Float64"}- column "page_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "touchpoint_timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "unique_url_count" {- type = "AggregateFunction(uniqCombined(12), String)"+ column "touchpoint_weight" {+ type = "Float64"}- column "login_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "campaign_name" {+ type = "String"}- column "signup_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "source_name" {+ type = "String"}- column "checkout_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "medium_name" {+ type = "String"}- column "cart_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "content_name" {+ type = "String"}- column "billing_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "term_name" {+ type = "String"}- column "settings_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "referring_domain_name" {+ type = "String"}- column "account_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "gclid_name" {+ type = "String"}- column "error_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "fbclid_name" {+ type = "String"}- column "not_found_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "gad_source_name" {+ type = "String"}- column "admin_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "computed_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now()"}- column "dashboard_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "expires_at" {+ type = "Date"+ default = "today() + toIntervalDay(7)"}- column "onboarding_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/noshard/posthog.conversion_goal_attributed_preaggregated"+ replica_name = "{replica}-{shard}"+ version_column = "computed_at"}- column "cancel_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ }++ table "sharded_distinct_id_usage" {+ order_by = ["team_id", "minute", "distinct_id"]+ partition_by = "toYYYYMMDD(minute)"+ ttl = "toDate(minute) + toIntervalDay(7)"+ settings = {+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}- column "refund_path_visit_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "team_id" {+ type = "Int64"}- column "console_error_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "distinct_id" {+ type = "String"}- column "console_error_after_click_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "minute" {+ type = "DateTime"}- column "console_warn_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "event_count" {+ type = "UInt64"}- column "network_request_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ engine "replicated_summing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.distinct_id_usage"+ replica_name = "{replica}"+ sum_columns = ["event_count"]}- column "network_failed_request_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ }++ table "sharded_events" {+ order_by = ["team_id", "toDate(timestamp)", "event", "cityHash64(distinct_id)", "cityHash64(uuid)"]+ partition_by = "toYYYYMM(timestamp)"+ sample_by = "cityHash64(distinct_id)"+ settings = {+ index_granularity = "8192"}- column "network_4xx_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "uuid" {+ type = "UUID"}- column "network_5xx_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "event" {+ type = "String"}- column "network_request_duration_sum" {- type = "SimpleAggregateFunction(sum, Float64)"+ column "properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "network_request_duration_sum_of_squares" {- type = "SimpleAggregateFunction(sum, Float64)"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "network_request_duration_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "team_id" {+ type = "Int64"}- column "mutation_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "distinct_id" {+ type = "String"}- column "viewport_resize_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "created_at" {+ type = "DateTime64(6, 'UTC')"}- column "touch_event_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "$group_0" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^\"|\"$', '')"+ comment = "column_materializer::$group_0"}- column "max_scroll_y" {- type = "SimpleAggregateFunction(max, Float64)"+ column "$group_1" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_1'), '^\"|\"$', '')"+ comment = "column_materializer::$group_1"}- column "unique_click_target_count" {- type = "AggregateFunction(uniqCombined(12), Int64)"+ column "$group_2" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_2'), '^\"|\"$', '')"+ comment = "column_materializer::$group_2"}- column "unique_form_field_count" {- type = "AggregateFunction(uniqCombined(12), Int64)"+ column "$group_3" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_3'), '^\"|\"$', '')"+ comment = "column_materializer::$group_3"}- column "text_selection_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "$group_4" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_4'), '^\"|\"$', '')"+ comment = "column_materializer::$group_4"}- column "selection_copy_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "$window_id" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$window_id'), '^\"|\"$', '')"+ comment = "column_materializer::$window_id"}- column "is_deleted" {- type = "SimpleAggregateFunction(max, UInt8)"- default = "0"+ column "$session_id" {+ type = "String"+ materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$session_id'), '^\"|\"$', '')"+ comment = "column_materializer::$session_id"}- engine "distributed" {- cluster_name = "aux"- remote_database = "posthog"- remote_table = "sharded_session_replay_features"- sharding_key = "sipHash64(session_id)"+ column "inserted_at" {+ type = "Nullable(DateTime64(6, 'UTC'))"+ default = "now64()"}- }-- table "sessions" {- column "session_id" {- type = "String"+ column "person_mode" {+ type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"}- column "team_id" {- type = "Int64"+ column "elements_chain_href" {+ type = "String"+ materialized = "EXTRACT(elements_chain, '(?::|\")href=\"(.*?)\"')"}- column "distinct_id" {- type = "SimpleAggregateFunction(any, String)"+ column "elements_chain_texts" {+ type = "Array(String)"+ materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")text=\"(.*?)\"'))"}- column "min_timestamp" {- type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"+ column "elements_chain_ids" {+ type = "Array(String)"+ materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")attr_id=\"(.*?)\"'))"}- column "max_timestamp" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"+ column "elements_chain_elements" {+ type = "Array(Enum8('a'=1, 'button'=2, 'form'=3, 'input'=4, 'select'=5, 'textarea'=6, 'label'=7))"+ materialized = "arrayDistinct(extractAll(elements_chain, '(?:^|;)(a|button|form|input|select|textarea|label)(?:\\\\.|$|:)'))"}- column "urls" {- type = "SimpleAggregateFunction(groupUniqArrayArray, Array(String))"+ column "properties_group_custom" {+ type = "Map(String, String)"+ materialized = "mapSort(mapFilter((key, _) -> ((key NOT LIKE '$%') AND (key NOT IN ('token', 'distinct_id', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'gclid', 'gad_source', 'gclsrc', 'dclid', 'gbraid', 'wbraid', 'fbclid', 'msclkid', 'twclid', 'li_fat_id', 'mc_cid', 'igshid', 'ttclid', 'rdt_cid', 'epik', 'qclid', 'sccid', 'irclid', '_kx'))), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"+ codec = "ZSTD(1)"}- column "entry_url" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "properties_group_feature_flags" {+ type = "Map(String, String)"+ materialized = "mapSort(mapFilter((key, _) -> (key LIKE '$feature/%'), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"+ codec = "ZSTD(1)"}- column "exit_url" {- type = "AggregateFunction(argMax, String, DateTime64(6, 'UTC'))"+ column "is_deleted" {+ type = "Bool"}- column "initial_referring_domain" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "person_properties_map_custom" {+ type = "Map(String, String)"+ materialized = "mapSort(mapFilter((key, _) -> (key NOT LIKE '$%'), CAST(JSONExtractKeysAndValues(person_properties, 'String'), 'Map(String, String)')))"+ codec = "ZSTD(1)"}- column "initial_utm_source" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "$session_id_uuid" {+ type = "Nullable(UInt128)"+ materialized = "toUInt128(JSONExtract(properties, '$session_id', 'Nullable(UUID)'))"}- column "initial_utm_campaign" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "consumer_breadcrumbs" {+ type = "Array(String)"}- column "initial_utm_medium" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "properties_group_ai" {+ type = "Map(String, String)"+ materialized = "mapSort(mapFilter((key, _) -> ((key LIKE '$ai_%') AND (key NOT IN ('$ai_input', '$ai_input_state', '$ai_output', '$ai_output_choices', '$ai_output_state', '$ai_tools'))), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"+ codec = "ZSTD(1)"}- column "initial_utm_term" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "mat_$ai_session_id" {+ type = "Nullable(String)"+ materialized = "JSONExtract(properties, '$ai_session_id', 'Nullable(String)')"}- column "initial_utm_content" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "mat_$ai_is_error" {+ type = "Nullable(String)"+ materialized = "JSONExtract(properties, '$ai_is_error', 'Nullable(String)')"}- column "initial_gclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "dmat_string_0" {+ type = "Nullable(String)"}- column "initial_gad_source" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "dmat_string_1" {+ type = "Nullable(String)"}- column "initial_gclsrc" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "dmat_string_2" {+ type = "Nullable(String)"}- column "initial_dclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "dmat_string_3" {+ type = "Nullable(String)"}- column "initial_gbraid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "dmat_string_4" {+ type = "Nullable(String)"}- column "initial_wbraid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "dmat_string_5" {+ type = "Nullable(String)"}- column "initial_fbclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "dmat_string_6" {+ type = "Nullable(String)"}- column "initial_msclkid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "dmat_string_7" {+ type = "Nullable(String)"}- column "initial_twclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "dmat_string_8" {+ type = "Nullable(String)"}- column "initial_li_fat_id" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "dmat_string_9" {+ type = "Nullable(String)"}- column "initial_mc_cid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "historical_migration" {+ type = "Bool"}- column "initial_igshid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "mat_$ai_prompt_name" {+ type = "Nullable(String)"+ materialized = "JSONExtract(properties, '$ai_prompt_name', 'Nullable(String)')"}- column "initial_ttclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "properties_map_ephemeral" {+ type = "Map(String, String)"}- column "initial_epik" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "person_properties_map_ephemeral" {+ type = "Map(String, String)"}- column "initial_qclid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "mat_$ai_experiment_id" {+ type = "Nullable(String)"+ default = "JSONExtract(properties, '$ai_experiment_id', 'Nullable(String)')"}- column "initial_sccid" {- type = "AggregateFunction(argMin, String, DateTime64(6, 'UTC'))"+ column "elements_chain" {+ type = "String"}- column "event_count_map" {- type = "SimpleAggregateFunction(sumMap, Map(String, Int64))"+ column "person_id" {+ type = "UUID"}- column "pageview_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "person_created_at" {+ type = "DateTime64(3)"}- column "autocapture_count" {- type = "SimpleAggregateFunction(sum, Int64)"+ column "person_properties" {+ type = "String"+ codec = "ZSTD(3)"}- engine "distributed" {- cluster_name = "posthog"- remote_database = "posthog"- remote_table = "sharded_sessions"- sharding_key = "sipHash64(session_id)"+ column "group0_properties" {+ type = "String"+ codec = "ZSTD(3)"}- }-- table "sharded_ai_events" {- order_by = ["team_id", "trace_id", "timestamp"]- partition_by = "toYYYYMM(drop_date)"- ttl = "drop_date"- settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"+ column "group1_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "uuid" {- type = "UUID"+ column "group2_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "event" {- type = "LowCardinality(String)"+ column "group3_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "timestamp" {- type = "DateTime64(6, 'UTC')"+ column "group4_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "team_id" {- type = "Int64"+ column "group0_created_at" {+ type = "DateTime64(3)"}- column "distinct_id" {- type = "String"+ column "group1_created_at" {+ type = "DateTime64(3)"}- column "person_id" {- type = "UUID"+ column "group2_created_at" {+ type = "DateTime64(3)"}- column "properties" {- type = "String"+ column "group3_created_at" {+ type = "DateTime64(3)"}- column "retention_days" {- type = "Int16"- default = "30"+ column "group4_created_at" {+ type = "DateTime64(3)"}- column "drop_date" {- type = "Date"- materialized = "toDate(timestamp) + toIntervalDay(retention_days)"+ column "_timestamp" {+ type = "DateTime"}- column "trace_id" {- type = "String"+ column "_offset" {+ type = "UInt64"}- column "session_id" {- type = "Nullable(String)"+ column "mat_$ai_trace_id" {+ type = "Nullable(String)"+ materialized = "JSONExtract(properties, '$ai_trace_id', 'Nullable(String)')"}- column "parent_id" {- type = "Nullable(String)"+ index "minmax_inserted_at" {+ expr = "coalesce(inserted_at, _timestamp)"+ type = "minmax"+ granularity = 1}- column "span_id" {- type = "Nullable(String)"+ index "properties_group_custom_keys_bf" {+ expr = "mapKeys(properties_group_custom)"+ type = "bloom_filter"+ granularity = 1}- column "span_type" {- type = "LowCardinality(Nullable(String))"+ index "properties_group_custom_values_bf" {+ expr = "mapValues(properties_group_custom)"+ type = "bloom_filter"+ granularity = 1}- column "generation_id" {- type = "Nullable(String)"+ index "properties_group_feature_flags_keys_bf" {+ expr = "mapKeys(properties_group_feature_flags)"+ type = "bloom_filter"+ granularity = 1}- column "experiment_id" {- type = "Nullable(String)"+ index "properties_group_feature_flags_values_bf" {+ expr = "mapValues(properties_group_feature_flags)"+ type = "bloom_filter"+ granularity = 1}- column "span_name" {- type = "Nullable(String)"+ index "person_properties_map_custom_keys_bf" {+ expr = "mapKeys(person_properties_map_custom)"+ type = "bloom_filter"+ granularity = 1}- column "trace_name" {- type = "Nullable(String)"+ index "person_properties_map_custom_values_bf" {+ expr = "mapValues(person_properties_map_custom)"+ type = "bloom_filter"+ granularity = 1}- column "prompt_name" {- type = "Nullable(String)"+ index "properties_group_ai_keys_bf" {+ expr = "mapKeys(properties_group_ai)"+ type = "bloom_filter"+ granularity = 1}- column "model" {- type = "LowCardinality(Nullable(String))"- }- column "provider" {- type = "LowCardinality(Nullable(String))"- }- column "framework" {- type = "LowCardinality(Nullable(String))"- }- column "total_tokens" {- type = "Nullable(Int64)"- }- column "input_tokens" {- type = "Nullable(Int64)"- }- column "output_tokens" {- type = "Nullable(Int64)"- }- column "text_input_tokens" {- type = "Nullable(Int64)"- }- column "text_output_tokens" {- type = "Nullable(Int64)"- }- column "image_input_tokens" {- type = "Nullable(Int64)"- }- column "image_output_tokens" {- type = "Nullable(Int64)"- }- column "audio_input_tokens" {- type = "Nullable(Int64)"- }- column "audio_output_tokens" {- type = "Nullable(Int64)"- }- column "video_input_tokens" {- type = "Nullable(Int64)"- }- column "video_output_tokens" {- type = "Nullable(Int64)"- }- column "reasoning_tokens" {- type = "Nullable(Int64)"- }- column "cache_read_input_tokens" {- type = "Nullable(Int64)"- }- column "cache_creation_input_tokens" {- type = "Nullable(Int64)"- }- column "web_search_count" {- type = "Nullable(Int64)"- }- column "input_cost_usd" {- type = "Nullable(Float64)"- }- column "output_cost_usd" {- type = "Nullable(Float64)"- }- column "total_cost_usd" {- type = "Nullable(Float64)"- }- column "request_cost_usd" {- type = "Nullable(Float64)"- }- column "web_search_cost_usd" {- type = "Nullable(Float64)"- }- column "audio_cost_usd" {- type = "Nullable(Float64)"- }- column "image_cost_usd" {- type = "Nullable(Float64)"- }- column "video_cost_usd" {- type = "Nullable(Float64)"- }- column "latency" {- type = "Nullable(Float64)"- }- column "time_to_first_token" {- type = "Nullable(Float64)"- }- column "is_error" {- type = "UInt8"- }- column "error" {- type = "Nullable(String)"- }- column "error_type" {- type = "LowCardinality(Nullable(String))"- }- column "error_normalized" {- type = "Nullable(String)"- }- column "input" {- type = "Nullable(String)"- }- column "output" {- type = "Nullable(String)"- }- column "output_choices" {- type = "Nullable(String)"- }- column "input_state" {- type = "Nullable(String)"- }- column "output_state" {- type = "Nullable(String)"- }- column "tools" {- type = "Nullable(String)"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "_partition" {- type = "UInt64"- }- index "idx_trace_id" {- expr = "trace_id"- type = "bloom_filter(0.001)"- granularity = 1- }- index "idx_session_id" {- expr = "session_id"- type = "bloom_filter(0.01)"- granularity = 1- }- index "idx_parent_id" {- expr = "parent_id"- type = "bloom_filter(0.01)"- granularity = 1- }- index "idx_span_id" {- expr = "span_id"- type = "bloom_filter(0.01)"- granularity = 1- }- index "idx_prompt_name" {- expr = "prompt_name"- type = "bloom_filter(0.01)"- granularity = 1- }- index "idx_model" {- expr = "model"- type = "bloom_filter(0.01)"- granularity = 1- }- index "idx_experiment_id" {- expr = "experiment_id"- type = "bloom_filter(0.01)"+ index "properties_group_ai_values_bf" {+ expr = "mapValues(properties_group_ai)"+ type = "bloom_filter"granularity = 1}- index "idx_event" {- expr = "event"- type = "set(20)"- granularity = 1+ index "bloom_filter_$ai_trace_id" {+ expr = "`mat_$ai_trace_id`"+ type = "bloom_filter(0.001)"+ granularity = 2}- index "idx_is_error" {- expr = "is_error"- type = "set(2)"+ index "bloom_filter_$ai_session_id" {+ expr = "`mat_$ai_session_id`"+ type = "bloom_filter"granularity = 1}- index "idx_provider" {- expr = "provider"- type = "set(50)"+ index "minmax_$ai_session_id" {+ expr = "`mat_$ai_session_id`"+ type = "minmax"granularity = 1}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.ai_events"- replica_name = "{replica}"- }- }-- table "sharded_app_metrics" {- order_by = ["team_id", "plugin_config_id", "job_id", "category", "toStartOfHour(timestamp)", "error_type", "error_uuid"]- partition_by = "toYYYYMM(timestamp)"- settings = {- index_granularity = "8192"- }- column "team_id" {- type = "Int64"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "plugin_config_id" {- type = "Int64"- }- column "category" {- type = "LowCardinality(String)"- }- column "job_id" {- type = "String"- }- column "successes" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "successes_on_retry" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "failures" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "error_uuid" {- type = "UUID"- }- column "error_type" {- type = "String"- }- column "error_details" {- type = "String"- codec = "ZSTD(3)"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "_partition" {- type = "UInt64"- }- engine "replicated_aggregating_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_app_metrics"- replica_name = "{replica}"- }- }-- table "sharded_app_metrics2" {- order_by = ["team_id", "app_source", "app_source_id", "instance_id", "toStartOfHour(timestamp)", "metric_kind", "metric_name"]- partition_by = "toYYYYMM(timestamp)"- ttl = "toDate(timestamp) + toIntervalDay(90)"- settings = {- index_granularity = "8192"- }- column "team_id" {- type = "Int64"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "app_source" {- type = "LowCardinality(String)"- }- column "app_source_id" {- type = "String"- }- column "instance_id" {- type = "String"- }- column "metric_kind" {- type = "LowCardinality(String)"- }- column "metric_name" {- type = "LowCardinality(String)"- }- column "count" {- type = "SimpleAggregateFunction(sum, Int64)"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "_partition" {- type = "UInt64"- }- engine "replicated_aggregating_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_app_metrics2"- replica_name = "{replica}"- }- }-- table "sharded_billing_usage_records" {- order_by = ["team_id", "toDate(timestamp)", "producer_id", "usage_key", "record_id"]- partition_by = "toYYYYMM(timestamp)"- settings = {- index_granularity = "8192"- }- column "schema_version" {- type = "UInt8"- }- column "record_id" {- type = "String"- }- column "producer_id" {- type = "LowCardinality(String)"- }- column "team_id" {- type = "Int64"- }- column "organization_id" {- type = "UUID"- }- column "usage_key" {- type = "LowCardinality(String)"- }- column "unit" {- type = "LowCardinality(String)"- }- column "quantity" {- type = "Int64"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "inserted_at" {- type = "DateTime64(6, 'UTC')"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "_partition" {- type = "UInt64"- }- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_billing_usage_records"- replica_name = "{replica}"- version_column = "inserted_at"- }- }-- table "sharded_conversion_goal_attributed_preaggregated" {- order_by = ["team_id", "job_id", "person_id", "conversion_timestamp", "touchpoint_timestamp"]- partition_by = "toYYYYMMDD(expires_at)"- ttl = "expires_at"- settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"- }- column "team_id" {- type = "Int64"- }- column "job_id" {- type = "UUID"- }- column "person_id" {- type = "UUID"- }- column "conversion_timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "conversion_value" {- type = "Float64"- }- column "touchpoint_timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "touchpoint_weight" {- type = "Float64"- }- column "campaign_name" {- type = "String"- }- column "source_name" {- type = "String"- }- column "medium_name" {- type = "String"- }- column "content_name" {- type = "String"- }- column "term_name" {- type = "String"- }- column "referring_domain_name" {- type = "String"- }- column "gclid_name" {- type = "String"- }- column "fbclid_name" {- type = "String"- }- column "gad_source_name" {- type = "String"- }- column "computed_at" {- type = "DateTime64(6, 'UTC')"- default = "now()"- }- column "expires_at" {- type = "Date"- default = "today() + toIntervalDay(7)"- }- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.conversion_goal_attributed_preaggregated"- replica_name = "{replica}-{shard}"- version_column = "computed_at"- }- }-- table "sharded_distinct_id_usage" {- order_by = ["team_id", "minute", "distinct_id"]- partition_by = "toYYYYMMDD(minute)"- ttl = "toDate(minute) + toIntervalDay(7)"- settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"- }- column "team_id" {- type = "Int64"- }- column "distinct_id" {- type = "String"- }- column "minute" {- type = "DateTime"- }- column "event_count" {- type = "UInt64"- }- engine "replicated_summing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.distinct_id_usage"- replica_name = "{replica}"- sum_columns = ["event_count"]- }- }-- table "sharded_events" {- order_by = ["team_id", "toDate(timestamp)", "event", "cityHash64(distinct_id)", "cityHash64(uuid)"]- partition_by = "toYYYYMM(timestamp)"- sample_by = "cityHash64(distinct_id)"- settings = {- index_granularity = "8192"- }- column "uuid" {- type = "UUID"- }- column "event" {- type = "String"- }- column "properties" {- type = "String"- codec = "ZSTD(3)"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "distinct_id" {- type = "String"- }- column "created_at" {- type = "DateTime64(6, 'UTC')"- }- column "$group_0" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^\"|\"$', '')"- comment = "column_materializer::$group_0"- }- column "$group_1" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_1'), '^\"|\"$', '')"- comment = "column_materializer::$group_1"- }- column "$group_2" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_2'), '^\"|\"$', '')"- comment = "column_materializer::$group_2"- }- column "$group_3" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_3'), '^\"|\"$', '')"- comment = "column_materializer::$group_3"- }- column "$group_4" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$group_4'), '^\"|\"$', '')"- comment = "column_materializer::$group_4"- }- column "$window_id" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$window_id'), '^\"|\"$', '')"- comment = "column_materializer::$window_id"- }- column "$session_id" {- type = "String"- materialized = "replaceRegexpAll(JSONExtractRaw(properties, '$session_id'), '^\"|\"$', '')"- comment = "column_materializer::$session_id"- }- column "inserted_at" {- type = "Nullable(DateTime64(6, 'UTC'))"- default = "now64()"- }- column "person_mode" {- type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"- }- column "elements_chain_href" {- type = "String"- materialized = "EXTRACT(elements_chain, '(?::|\")href=\"(.*?)\"')"- }- column "elements_chain_texts" {- type = "Array(String)"- materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")text=\"(.*?)\"'))"- }- column "elements_chain_ids" {- type = "Array(String)"- materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")attr_id=\"(.*?)\"'))"- }- column "elements_chain_elements" {- type = "Array(Enum8('a'=1, 'button'=2, 'form'=3, 'input'=4, 'select'=5, 'textarea'=6, 'label'=7))"- materialized = "arrayDistinct(extractAll(elements_chain, '(?:^|;)(a|button|form|input|select|textarea|label)(?:\\\\.|$|:)'))"- }- column "properties_group_custom" {- type = "Map(String, String)"- materialized = "mapSort(mapFilter((key, _) -> ((key NOT LIKE '$%') AND (key NOT IN ('token', 'distinct_id', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'gclid', 'gad_source', 'gclsrc', 'dclid', 'gbraid', 'wbraid', 'fbclid', 'msclkid', 'twclid', 'li_fat_id', 'mc_cid', 'igshid', 'ttclid', 'rdt_cid', 'epik', 'qclid', 'sccid', 'irclid', '_kx'))), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"- codec = "ZSTD(1)"- }- column "properties_group_feature_flags" {- type = "Map(String, String)"- materialized = "mapSort(mapFilter((key, _) -> (key LIKE '$feature/%'), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"- codec = "ZSTD(1)"- }- column "is_deleted" {- type = "Bool"- }- column "person_properties_map_custom" {- type = "Map(String, String)"- materialized = "mapSort(mapFilter((key, _) -> (key NOT LIKE '$%'), CAST(JSONExtractKeysAndValues(person_properties, 'String'), 'Map(String, String)')))"- codec = "ZSTD(1)"- }- column "$session_id_uuid" {- type = "Nullable(UInt128)"- materialized = "toUInt128(JSONExtract(properties, '$session_id', 'Nullable(UUID)'))"- }- column "consumer_breadcrumbs" {- type = "Array(String)"- }- column "properties_group_ai" {- type = "Map(String, String)"- materialized = "mapSort(mapFilter((key, _) -> ((key LIKE '$ai_%') AND (key NOT IN ('$ai_input', '$ai_input_state', '$ai_output', '$ai_output_choices', '$ai_output_state', '$ai_tools'))), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"- codec = "ZSTD(1)"- }- column "mat_$ai_session_id" {- type = "Nullable(String)"- materialized = "JSONExtract(properties, '$ai_session_id', 'Nullable(String)')"- }- column "mat_$ai_is_error" {- type = "Nullable(String)"- materialized = "JSONExtract(properties, '$ai_is_error', 'Nullable(String)')"- }- column "dmat_string_0" {- type = "Nullable(String)"- }- column "dmat_string_1" {- type = "Nullable(String)"- }- column "dmat_string_2" {- type = "Nullable(String)"- }- column "dmat_string_3" {- type = "Nullable(String)"- }- column "dmat_string_4" {- type = "Nullable(String)"- }- column "dmat_string_5" {- type = "Nullable(String)"- }- column "dmat_string_6" {- type = "Nullable(String)"- }- column "dmat_string_7" {- type = "Nullable(String)"- }- column "dmat_string_8" {- type = "Nullable(String)"- }- column "dmat_string_9" {- type = "Nullable(String)"- }- column "historical_migration" {- type = "Bool"- }- column "mat_$ai_prompt_name" {- type = "Nullable(String)"- materialized = "JSONExtract(properties, '$ai_prompt_name', 'Nullable(String)')"- }- column "properties_map_ephemeral" {- type = "Map(String, String)"- }- column "person_properties_map_ephemeral" {- type = "Map(String, String)"- }- column "mat_$ai_experiment_id" {- type = "Nullable(String)"- default = "JSONExtract(properties, '$ai_experiment_id', 'Nullable(String)')"- }- column "elements_chain" {- type = "String"- }- column "person_id" {- type = "UUID"- }- column "person_created_at" {- type = "DateTime64(3)"- }- column "person_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group0_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group1_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group2_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group3_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group4_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group0_created_at" {- type = "DateTime64(3)"- }- column "group1_created_at" {- type = "DateTime64(3)"- }- column "group2_created_at" {- type = "DateTime64(3)"- }- column "group3_created_at" {- type = "DateTime64(3)"- }- column "group4_created_at" {- type = "DateTime64(3)"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "mat_$ai_trace_id" {- type = "Nullable(String)"- materialized = "JSONExtract(properties, '$ai_trace_id', 'Nullable(String)')"- }- index "minmax_inserted_at" {- expr = "coalesce(inserted_at, _timestamp)"- type = "minmax"- granularity = 1- }- index "properties_group_custom_keys_bf" {- expr = "mapKeys(properties_group_custom)"- type = "bloom_filter"- granularity = 1- }- index "properties_group_custom_values_bf" {- expr = "mapValues(properties_group_custom)"- type = "bloom_filter"- granularity = 1- }- index "properties_group_feature_flags_keys_bf" {- expr = "mapKeys(properties_group_feature_flags)"- type = "bloom_filter"- granularity = 1- }- index "properties_group_feature_flags_values_bf" {- expr = "mapValues(properties_group_feature_flags)"- type = "bloom_filter"- granularity = 1- }- index "person_properties_map_custom_keys_bf" {- expr = "mapKeys(person_properties_map_custom)"- type = "bloom_filter"- granularity = 1- }- index "person_properties_map_custom_values_bf" {- expr = "mapValues(person_properties_map_custom)"- type = "bloom_filter"- granularity = 1- }- index "properties_group_ai_keys_bf" {- expr = "mapKeys(properties_group_ai)"- type = "bloom_filter"- granularity = 1- }- index "properties_group_ai_values_bf" {- expr = "mapValues(properties_group_ai)"- type = "bloom_filter"- granularity = 1- }- index "bloom_filter_$ai_trace_id" {- expr = "`mat_$ai_trace_id`"- type = "bloom_filter(0.001)"- granularity = 2- }- index "bloom_filter_$ai_session_id" {- expr = "`mat_$ai_session_id`"- type = "bloom_filter"- granularity = 1- }- index "minmax_$ai_session_id" {- expr = "`mat_$ai_session_id`"- type = "minmax"- granularity = 1- }- index "set_$ai_is_error" {- expr = "`mat_$ai_is_error`"- type = "set(7)"- granularity = 1- }- index "bloom_filter_distinct_id" {- expr = "distinct_id"- type = "bloom_filter"- granularity = 1- }- index "minmax_sharded_events_timestamp" {- expr = "timestamp"- type = "minmax"- granularity = 1- }- index "bloom_filter_$ai_prompt_name" {- expr = "`mat_$ai_prompt_name`"- type = "bloom_filter"- granularity = 1- }- index "minmax_$ai_prompt_name" {- expr = "`mat_$ai_prompt_name`"- type = "minmax"- granularity = 1- }- index "bloom_filter_$ai_experiment_id" {- expr = "`mat_$ai_experiment_id`"- type = "bloom_filter"- granularity = 1- }- index "minmax_$ai_experiment_id" {- expr = "`mat_$ai_experiment_id`"- type = "minmax"- granularity = 1- }- index "minmax_$session_id_uuid" {- expr = "`$session_id_uuid`"- type = "minmax"- granularity = 1- }- index "bloom_filter_$session_id" {- expr = "nullIf(nullIf(`$session_id`, ''), 'null')"- type = "bloom_filter"- granularity = 1- }- index "minmax_$group_0" {- expr = "`$group_0`"- type = "minmax"- granularity = 1- }- index "minmax_$group_1" {- expr = "`$group_1`"- type = "minmax"- granularity = 1- }- index "minmax_$group_2" {- expr = "`$group_2`"- type = "minmax"- granularity = 1- }- index "minmax_$group_3" {- expr = "`$group_3`"- type = "minmax"- granularity = 1- }- index "minmax_$group_4" {- expr = "`$group_4`"- type = "minmax"- granularity = 1- }- index "minmax_$window_id" {- expr = "`$window_id`"- type = "minmax"- granularity = 1- }- index "minmax_$session_id" {- expr = "`$session_id`"- type = "minmax"- granularity = 1- }- index "kafka_timestamp_minmax_sharded_events" {- expr = "_timestamp"- type = "minmax"- granularity = 3- }- index "is_deleted_idx" {- expr = "is_deleted"- type = "minmax"- granularity = 1- }- index "minmax_historical_migration" {- expr = "historical_migration"- type = "minmax"- granularity = 1- }- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.events"- replica_name = "{replica}"- version_column = "_timestamp"- }- }-- table "sharded_events_json" {- primary_key = ["team_id", "toDate(timestamp)", "event", "cityHash64(distinct_id)"]- order_by = ["team_id", "toDate(timestamp)", "event", "cityHash64(distinct_id)", "timestamp", "uuid"]- partition_by = "clamp(toYYYYMM(timestamp), 202001, 203512)"- sample_by = "cityHash64(distinct_id)"- settings = {- enable_block_number_column = "1"- enable_block_offset_column = "1"- index_granularity = "8192"- map_serialization_version = "with_buckets"- object_serialization_version = "v3"- object_shared_data_serialization_version = "map_with_buckets"- propagate_types_serialization_versions_to_nested_types = "1"- string_serialization_version = "single_stream"- }- column "uuid" {- type = "UUID"- }- column "event" {- type = "String"- }- column "properties" {- type = "JSON(`$browser` LowCardinality(String), `$browser_language` LowCardinality(String), `$browser_version` LowCardinality(String), `$config_defaults` LowCardinality(String), `$device_type` LowCardinality(String), `$exception_functions` Array(String), `$exception_list` Array(JSON(max_dynamic_paths=0, type String, value String)), `$exception_sources` Array(String), `$exception_types` Array(String), `$exception_values` Array(String), `$feature_flags` Map(LowCardinality(String), LowCardinality(String)), `$geoip_city_name` LowCardinality(String), `$geoip_continent_code` LowCardinality(String), `$geoip_continent_name` LowCardinality(String), `$geoip_country_code` LowCardinality(String), `$geoip_country_name` LowCardinality(String), `$geoip_subdivision_1_name` LowCardinality(String), `$geoip_time_zone` LowCardinality(String), `$group_0` String, `$group_1` String, `$group_2` String, `$group_3` String, `$group_4` String, `$lib` LowCardinality(String), `$lib_version` LowCardinality(String), `$mcp_listed_tool_names` Array(String), `$os` LowCardinality(String), `$os_version` LowCardinality(String), `$session_id` String, `$timezone` LowCardinality(String), `$window_id` String)"- }- column "temporary_properties" {- type = "JSON(max_dynamic_paths=32)"- ttl = "toDateTime(inserted_at) + toIntervalDay(60)"- }- column "properties_null_keys" {- type = "Array(LowCardinality(String))"- }- column "temporary_properties_null_keys" {- type = "Array(LowCardinality(String))"- ttl = "toDateTime(inserted_at) + toIntervalDay(60)"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- codec = "GCD, Default"- }- column "team_id" {- type = "Int64"- }- column "distinct_id" {- type = "String"- }- column "created_at" {- type = "DateTime64(6, 'UTC')"- default = "now()"- codec = "GCD, Default"- }- column "_timestamp" {- type = "DateTime"- codec = "T64, Default"- }- column "_offset" {- type = "UInt64"- codec = "T64, Default"- }- column "elements_chain" {- type = "String"- }- column "person_id" {- type = "UUID"- }- column "person_properties" {- type = "JSON(max_dynamic_paths=256, `$browser` LowCardinality(String), `$browser_language` LowCardinality(String), `$browser_version` LowCardinality(String), `$device_type` LowCardinality(String), `$geoip_city_name` LowCardinality(String), `$geoip_continent_code` LowCardinality(String), `$geoip_continent_name` LowCardinality(String), `$geoip_country_code` LowCardinality(String), `$geoip_country_name` LowCardinality(String), `$geoip_subdivision_1_name` LowCardinality(String), `$geoip_time_zone` LowCardinality(String), `$initial_browser` LowCardinality(String), `$initial_browser_language` LowCardinality(String), `$initial_browser_version` LowCardinality(String), `$initial_device_type` LowCardinality(String), `$initial_geoip_city_name` LowCardinality(String), `$initial_geoip_continent_code` LowCardinality(String), `$initial_geoip_continent_name` LowCardinality(String), `$initial_geoip_country_code` LowCardinality(String), `$initial_geoip_country_name` LowCardinality(String), `$initial_geoip_subdivision_1_name` LowCardinality(String), `$initial_geoip_time_zone` LowCardinality(String), `$initial_os` LowCardinality(String), `$initial_os_version` LowCardinality(String), `$os` LowCardinality(String), `$os_version` LowCardinality(String))"- }- column "person_properties_null_keys" {- type = "Array(LowCardinality(String))"- }- column "group0_properties" {- type = "String"- }- column "group1_properties" {- type = "String"- }- column "group2_properties" {- type = "String"- }- column "group3_properties" {- type = "String"- }- column "group4_properties" {- type = "String"- }- column "person_created_at" {- type = "DateTime64(3)"- codec = "GCD, Default"- }- column "group0_created_at" {- type = "DateTime64(3)"- }- column "group1_created_at" {- type = "DateTime64(3)"- }- column "group2_created_at" {- type = "DateTime64(3)"- }- column "group3_created_at" {- type = "DateTime64(3)"- }- column "group4_created_at" {- type = "DateTime64(3)"- }- column "inserted_at" {- type = "DateTime64(6, 'UTC')"- default = "now64()"- codec = "GCD, Default"- }- column "person_mode" {- type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"- }- column "consumer_breadcrumbs" {- type = "Array(String)"- }- column "historical_migration" {- type = "Bool"- }- column "total_event_size" {- type = "UInt32"- codec = "T64, Default"- }- column "captured_at" {- type = "DateTime64(6, 'UTC')"- default = "now()"- codec = "GCD, Default"- }- column "_partition" {- type = "UInt64"- codec = "T64, Default"- }- column "elements_chain_href" {- type = "String"- materialized = "EXTRACT(elements_chain, '(?::|\")href=\"(.*?)\"')"- }- column "elements_chain_texts" {- type = "Array(String)"- materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")text=\"(.*?)\"'))"- }- column "elements_chain_ids" {- type = "Array(String)"- materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")attr_id=\"(.*?)\"'))"- }- column "elements_chain_elements" {- type = "Array(Enum8('a'=1, 'button'=2, 'form'=3, 'input'=4, 'select'=5, 'textarea'=6, 'label'=7))"- materialized = "arrayDistinct(extractAll(elements_chain, '(?:^|;)(a|button|form|input|select|textarea|label)(?:\\\\.|$|:)'))"- }- index "bloom_filter_distinct_id" {- expr = "distinct_id"- type = "bloom_filter"- granularity = 1- }- index "bloom_filter_uuid" {- expr = "uuid"- type = "bloom_filter"- granularity = 1- }- index "bloom_filter_person_id" {- expr = "person_id"- type = "bloom_filter"- granularity = 1- }- index "minmax_captured_at" {- expr = "captured_at"- type = "minmax"- granularity = 1- }- index "minmax_kafka_timestamp" {- expr = "_timestamp"- type = "minmax"- granularity = 1- }- index "minmax_inserted_at" {- expr = "inserted_at"- type = "minmax"- granularity = 1- }- index "minmax_timestamp" {- expr = "timestamp"- type = "minmax"- granularity = 1- }- index "minmax_historical_migration" {- expr = "historical_migration"- type = "minmax"- granularity = 1- }- index "minmax_created_at" {- expr = "created_at"- type = "minmax"- granularity = 1- }- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.events_json"- replica_name = "{replica}"- version_column = "_timestamp"- }- }-- table "sharded_events_recent" {- order_by = ["team_id", "toStartOfHour(inserted_at)", "event", "cityHash64(distinct_id)", "cityHash64(uuid)"]- partition_by = "toStartOfDay(inserted_at)"- ttl = "toDate(inserted_at) + toIntervalDay(9)"- settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"- }- column "uuid" {- type = "UUID"- }- column "event" {- type = "String"- }- column "properties" {- type = "String"- codec = "ZSTD(3)"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "distinct_id" {- type = "String"- }- column "elements_chain" {- type = "String"- }- column "created_at" {- type = "DateTime64(6, 'UTC')"- }- column "person_id" {- type = "UUID"- }- column "person_created_at" {- type = "DateTime64(3)"- }- column "person_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group0_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group1_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group2_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group3_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group4_properties" {- type = "String"- codec = "ZSTD(3)"- }- column "group0_created_at" {- type = "DateTime64(3)"- }- column "group1_created_at" {- type = "DateTime64(3)"- }- column "group2_created_at" {- type = "DateTime64(3)"- }- column "group3_created_at" {- type = "DateTime64(3)"- }- column "group4_created_at" {- type = "DateTime64(3)"- }- column "person_mode" {- type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"- }- column "historical_migration" {- type = "Bool"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "inserted_at" {- type = "DateTime64(6, 'UTC')"- default = "now64()"- }- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_events_recent"- replica_name = "{replica}"- version_column = "_timestamp"- }- }-- table "sharded_experiment_exposures_preaggregated" {- order_by = ["team_id", "job_id", "entity_id", "breakdown_value"]- partition_by = "toYYYYMMDD(expires_at)"- ttl = "expires_at"- settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"- }- column "team_id" {- type = "Int64"- }- column "job_id" {- type = "UUID"- }- column "entity_id" {- type = "String"- }- column "variant" {- type = "String"- }- column "first_exposure_time" {- type = "DateTime64(6, 'UTC')"- }- column "last_exposure_time" {- type = "DateTime64(6, 'UTC')"- }- column "exposure_event_uuid" {- type = "UUID"- }- column "exposure_session_id" {- type = "String"- }- column "breakdown_value" {- type = "Array(String)"- }- column "computed_at" {- type = "DateTime64(6, 'UTC')"- default = "now()"- }- column "expires_at" {- type = "Date"- default = "today() + toIntervalDay(7)"- }- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.experiment_exposures_preaggregated"- replica_name = "{replica}"- version_column = "computed_at"- }- }-- table "sharded_experiment_metric_events_preaggregated" {- order_by = ["team_id", "job_id", "entity_id", "timestamp", "event_uuid"]- partition_by = "toYYYYMMDD(expires_at)"- ttl = "expires_at"- settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"- }- column "team_id" {- type = "Int64"- }- column "job_id" {- type = "UUID"- }- column "entity_id" {- type = "String"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "event_uuid" {- type = "UUID"- }- column "session_id" {- type = "String"- }- column "numeric_value" {- type = "Float64"- default = "0"- }- column "steps" {- type = "Array(UInt8)"- default = "[]"- }- column "computed_at" {- type = "DateTime64(6, 'UTC')"- default = "now()"- }- column "expires_at" {- type = "Date"- default = "today() + toIntervalDay(7)"- }- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.experiment_metric_events_preaggregated"- replica_name = "{replica}-{shard}"- version_column = "computed_at"- }- }-- table "sharded_flag_evaluations" {- order_by = ["team_id", "flag_key", "toDate(timestamp)", "cityHash64(distinct_id)", "cityHash64(uuid)"]- partition_by = "toYYYYMM(timestamp)"- ttl = "toDate(timestamp) + toIntervalDay(90)"- settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"- }- column "uuid" {- type = "UUID"- }- column "event" {- type = "LowCardinality(String)"- }- column "properties" {- type = "String"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "distinct_id" {- type = "String"- }- column "created_at" {- type = "DateTime64(6, 'UTC')"- }- column "person_id" {- type = "UUID"- }- column "person_properties" {- type = "String"- default = "'{}'"- }- column "person_created_at" {- type = "DateTime64(3)"- }- column "inserted_at" {- type = "DateTime64(6, 'UTC')"- default = "timestamp"- }- column "person_mode" {- type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"- }- column "$group_0" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^\"|\"$', '')"- comment = "column_materializer::$group_0"- }- column "$group_1" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_1'), '^\"|\"$', '')"- comment = "column_materializer::$group_1"- }- column "$group_2" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_2'), '^\"|\"$', '')"- comment = "column_materializer::$group_2"- }- column "$group_3" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_3'), '^\"|\"$', '')"- comment = "column_materializer::$group_3"- }- column "$group_4" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_4'), '^\"|\"$', '')"- comment = "column_materializer::$group_4"- }- column "flag_key" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$feature_flag'), '^\"|\"$', '')"- comment = "column_materializer::properties::$feature_flag"- }- column "response" {- type = "LowCardinality(String)"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$feature_flag_response'), '^\"|\"$', '')"- comment = "column_materializer::properties::$feature_flag_response"- }- column "session_id" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$session_id'), '^\"|\"$', '')"- comment = "column_materializer::properties::$session_id"- }- column "request_id" {- type = "String"- default = "replaceRegexpAll(JSONExtractRaw(properties, '$feature_flag_request_id'), '^\"|\"$', '')"- comment = "column_materializer::properties::$feature_flag_request_id"- }- column "properties_group_custom" {- type = "Map(String, String)"- materialized = "mapSort(mapFilter((key, _) -> ((key NOT LIKE '$%') AND (key NOT IN ('token', 'distinct_id', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'gclid', 'gad_source', 'gclsrc', 'dclid', 'gbraid', 'wbraid', 'fbclid', 'msclkid', 'twclid', 'li_fat_id', 'mc_cid', 'igshid', 'ttclid', 'rdt_cid', 'epik', 'qclid', 'sccid', 'irclid', '_kx'))), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"- }- column "person_properties_map_custom" {- type = "Map(String, String)"- materialized = "mapSort(mapFilter((key, _) -> (key NOT LIKE '$%'), CAST(JSONExtractKeysAndValues(person_properties, 'String'), 'Map(String, String)')))"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "_partition" {- type = "UInt64"- }- index "distinct_id_idx" {- expr = "distinct_id"- type = "bloom_filter(0.01)"- granularity = 1- }- index "person_id_idx" {- expr = "person_id"- type = "bloom_filter(0.01)"- granularity = 1- }- index "session_id_idx" {- expr = "session_id"- type = "bloom_filter(0.01)"+ index "set_$ai_is_error" {+ expr = "`mat_$ai_is_error`"+ type = "set(7)"granularity = 1}- index "request_id_idx" {- expr = "request_id"- type = "bloom_filter(0.01)"+ index "bloom_filter_distinct_id" {+ expr = "distinct_id"+ type = "bloom_filter"granularity = 1}- index "inserted_at_idx" {- expr = "inserted_at"+ index "minmax_sharded_events_timestamp" {+ expr = "timestamp"type = "minmax"granularity = 1}- index "properties_group_custom_keys_bf" {- expr = "mapKeys(properties_group_custom)"+ index "bloom_filter_$ai_prompt_name" {+ expr = "`mat_$ai_prompt_name`"type = "bloom_filter"granularity = 1}- index "properties_group_custom_values_bf" {- expr = "mapValues(properties_group_custom)"- type = "bloom_filter"+ index "minmax_$ai_prompt_name" {+ expr = "`mat_$ai_prompt_name`"+ type = "minmax"granularity = 1}- index "person_properties_map_custom_keys_bf" {- expr = "mapKeys(person_properties_map_custom)"+ index "bloom_filter_$ai_experiment_id" {+ expr = "`mat_$ai_experiment_id`"type = "bloom_filter"granularity = 1}- index "person_properties_map_custom_values_bf" {- expr = "mapValues(person_properties_map_custom)"- type = "bloom_filter"+ index "minmax_$ai_experiment_id" {+ expr = "`mat_$ai_experiment_id`"+ type = "minmax"granularity = 1}- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.flag_evaluations"- replica_name = "{replica}"- version_column = "_timestamp"- }- }-- table "sharded_heatmaps" {- order_by = ["type", "team_id", "toDate(timestamp)", "current_url", "viewport_width"]- partition_by = "toYYYYMM(timestamp)"- ttl = "toDate(timestamp) + toIntervalDay(90)"- settings = {- index_granularity = "8192"- }- column "session_id" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "distinct_id" {- type = "String"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "x" {- type = "Int16"- }- column "y" {- type = "Int16"- }- column "scale_factor" {- type = "Int16"- }- column "viewport_width" {- type = "Int16"- }- column "viewport_height" {- type = "Int16"- }- column "pointer_target_fixed" {- type = "Bool"- }- column "current_url" {- type = "String"- }- column "type" {- type = "LowCardinality(String)"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "_partition" {- type = "UInt64"- }- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.heatmaps"- replica_name = "{replica}"- }- }-- table "sharded_ingestion_warnings" {- order_by = ["team_id", "toHour(timestamp)", "type", "source", "timestamp"]- partition_by = "toYYYYMMDD(timestamp)"- settings = {- index_granularity = "8192"- }- column "team_id" {- type = "Int64"- }- column "source" {- type = "LowCardinality(String)"- }- column "type" {- type = "String"- }- column "details" {- type = "String"- codec = "ZSTD(3)"- }- column "timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "_timestamp" {- type = "DateTime"- }- column "_offset" {- type = "UInt64"- }- column "_partition" {- type = "UInt64"+ index "minmax_$session_id_uuid" {+ expr = "`$session_id_uuid`"+ type = "minmax"+ granularity = 1}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_ingestion_warnings"- replica_name = "{replica}"+ index "bloom_filter_$session_id" {+ expr = "nullIf(nullIf(`$session_id`, ''), 'null')"+ type = "bloom_filter"+ granularity = 1}- }-- table "sharded_log_entries" {- order_by = ["team_id", "log_source", "log_source_id", "instance_id", "timestamp"]- partition_by = "toYYYYMMDD(timestamp)"- ttl = "toDate(timestamp) + toIntervalDay(90)"- settings = {- index_granularity = "1024"- ttl_only_drop_parts = "1"+ index "minmax_$group_0" {+ expr = "`$group_0`"+ type = "minmax"+ granularity = 1}- column "team_id" {- type = "UInt64"+ index "minmax_$group_1" {+ expr = "`$group_1`"+ type = "minmax"+ granularity = 1}- column "log_source" {- type = "LowCardinality(String)"+ index "minmax_$group_2" {+ expr = "`$group_2`"+ type = "minmax"+ granularity = 1}- column "log_source_id" {- type = "String"+ index "minmax_$group_3" {+ expr = "`$group_3`"+ type = "minmax"+ granularity = 1}- column "instance_id" {- type = "String"+ index "minmax_$group_4" {+ expr = "`$group_4`"+ type = "minmax"+ granularity = 1}- column "timestamp" {- type = "DateTime64(6, 'UTC')"+ index "minmax_$window_id" {+ expr = "`$window_id`"+ type = "minmax"+ granularity = 1}- column "level" {- type = "LowCardinality(String)"+ index "minmax_$session_id" {+ expr = "`$session_id`"+ type = "minmax"+ granularity = 1}- column "message" {- type = "String"+ index "kafka_timestamp_minmax_sharded_events" {+ expr = "_timestamp"+ type = "minmax"+ granularity = 3}- column "_timestamp" {- type = "DateTime"+ index "is_deleted_idx" {+ expr = "is_deleted"+ type = "minmax"+ granularity = 1}- column "_offset" {- type = "UInt64"+ index "minmax_historical_migration" {+ expr = "historical_migration"+ type = "minmax"+ granularity = 1}engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_log_entries"+ zoo_path = "/clickhouse/tables/{shard}/posthog.events"replica_name = "{replica}"version_column = "_timestamp"}}- table "sharded_marketing_conversions_preaggregated" {- order_by = ["team_id", "job_id", "person_id", "conversion_timestamp"]- partition_by = "toYYYYMMDD(expires_at)"- ttl = "expires_at"+ table "sharded_events_json" {+ primary_key = ["team_id", "toDate(timestamp)", "event", "cityHash64(distinct_id)"]+ order_by = ["team_id", "toDate(timestamp)", "event", "cityHash64(distinct_id)", "timestamp", "uuid"]+ partition_by = "clamp(toYYYYMM(timestamp), 202001, 203512)"+ sample_by = "cityHash64(distinct_id)"settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"- }- column "team_id" {- type = "Int64"- }- column "job_id" {- type = "UUID"- }- column "person_id" {- type = "UUID"- }- column "conversion_timestamp" {- type = "DateTime64(6, 'UTC')"- }- column "conversion_math_value" {- type = "Float64"- }- column "session_id" {- type = "String"- }- column "campaign_name" {- type = "String"- }- column "source_name" {- type = "String"- }- column "medium_name" {- type = "String"- }- column "content_name" {- type = "String"- }- column "term_name" {- type = "String"- }- column "referring_domain_name" {- type = "String"+ enable_block_number_column = "1"+ enable_block_offset_column = "1"+ index_granularity = "8192"+ map_serialization_version = "with_buckets"+ object_serialization_version = "v3"+ object_shared_data_serialization_version = "map_with_buckets"+ propagate_types_serialization_versions_to_nested_types = "1"+ string_serialization_version = "single_stream"}- column "gclid_name" {- type = "String"+ column "uuid" {+ type = "UUID"}- column "fbclid_name" {+ column "event" {type = "String"}- column "gad_source_name" {- type = "String"+ column "properties" {+ type = "JSON(`$browser` LowCardinality(String), `$browser_language` LowCardinality(String), `$browser_version` LowCardinality(String), `$config_defaults` LowCardinality(String), `$device_type` LowCardinality(String), `$exception_functions` Array(String), `$exception_list` Array(JSON(max_dynamic_paths=0, type String, value String)), `$exception_sources` Array(String), `$exception_types` Array(String), `$exception_values` Array(String), `$feature_flags` Map(LowCardinality(String), LowCardinality(String)), `$geoip_city_name` LowCardinality(String), `$geoip_continent_code` LowCardinality(String), `$geoip_continent_name` LowCardinality(String), `$geoip_country_code` LowCardinality(String), `$geoip_country_name` LowCardinality(String), `$geoip_subdivision_1_name` LowCardinality(String), `$geoip_time_zone` LowCardinality(String), `$group_0` String, `$group_1` String, `$group_2` String, `$group_3` String, `$group_4` String, `$lib` LowCardinality(String), `$lib_version` LowCardinality(String), `$mcp_listed_tool_names` Array(String), `$os` LowCardinality(String), `$os_version` LowCardinality(String), `$session_id` String, `$timezone` LowCardinality(String), `$window_id` String)"}- column "computed_at" {- type = "DateTime64(6, 'UTC')"- default = "now()"+ column "temporary_properties" {+ type = "JSON(max_dynamic_paths=32)"+ ttl = "toDateTime(inserted_at) + toIntervalDay(60)"}- column "expires_at" {- type = "Date"- default = "today() + toIntervalDay(7)"+ column "properties_null_keys" {+ type = "Array(LowCardinality(String))"}- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.marketing_conversions_preaggregated"- replica_name = "{replica}-{shard}"- version_column = "computed_at"+ column "temporary_properties_null_keys" {+ type = "Array(LowCardinality(String))"+ ttl = "toDateTime(inserted_at) + toIntervalDay(60)"}- }-- table "sharded_marketing_costs_preaggregated" {- order_by = ["team_id", "job_id", "source_name", "grain", "campaign_id", "ad_group_id", "ad_id", "cost_date"]- partition_by = "toYYYYMMDD(expires_at)"- ttl = "expires_at"- settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"+ codec = "GCD, Default"}column "team_id" {type = "Int64"}- column "job_id" {- type = "UUID"- }- column "source_id" {+ column "distinct_id" {type = "String"}- column "source_name" {- type = "String"+ column "created_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now()"+ codec = "GCD, Default"}- column "grain" {- type = "LowCardinality(String)"+ column "_timestamp" {+ type = "DateTime"+ codec = "T64, Default"}- column "match_key" {- type = "String"+ column "_offset" {+ type = "UInt64"+ codec = "T64, Default"}- column "campaign_id" {+ column "elements_chain" {type = "String"}- column "campaign_name" {+ column "person_id" {+ type = "UUID"+ }+ column "person_properties" {+ type = "JSON(max_dynamic_paths=256, `$browser` LowCardinality(String), `$browser_language` LowCardinality(String), `$browser_version` LowCardinality(String), `$device_type` LowCardinality(String), `$geoip_city_name` LowCardinality(String), `$geoip_continent_code` LowCardinality(String), `$geoip_continent_name` LowCardinality(String), `$geoip_country_code` LowCardinality(String), `$geoip_country_name` LowCardinality(String), `$geoip_subdivision_1_name` LowCardinality(String), `$geoip_time_zone` LowCardinality(String), `$initial_browser` LowCardinality(String), `$initial_browser_language` LowCardinality(String), `$initial_browser_version` LowCardinality(String), `$initial_device_type` LowCardinality(String), `$initial_geoip_city_name` LowCardinality(String), `$initial_geoip_continent_code` LowCardinality(String), `$initial_geoip_continent_name` LowCardinality(String), `$initial_geoip_country_code` LowCardinality(String), `$initial_geoip_country_name` LowCardinality(String), `$initial_geoip_subdivision_1_name` LowCardinality(String), `$initial_geoip_time_zone` LowCardinality(String), `$initial_os` LowCardinality(String), `$initial_os_version` LowCardinality(String), `$os` LowCardinality(String), `$os_version` LowCardinality(String))"+ }+ column "person_properties_null_keys" {+ type = "Array(LowCardinality(String))"+ }+ column "group0_properties" {type = "String"}- column "ad_group_id" {+ column "group1_properties" {type = "String"}- column "ad_group_name" {+ column "group2_properties" {type = "String"}- column "ad_id" {+ column "group3_properties" {type = "String"}- column "ad_name" {+ column "group4_properties" {type = "String"}- column "cost_date" {- type = "Date"+ column "person_created_at" {+ type = "DateTime64(3)"+ codec = "GCD, Default"}- column "cost" {- type = "Float64"+ column "group0_created_at" {+ type = "DateTime64(3)"}- column "clicks" {- type = "Float64"+ column "group1_created_at" {+ type = "DateTime64(3)"}- column "impressions" {- type = "Float64"+ column "group2_created_at" {+ type = "DateTime64(3)"}- column "reported_conversions" {- type = "Float64"+ column "group3_created_at" {+ type = "DateTime64(3)"}- column "reported_conversion_value" {- type = "Float64"+ column "group4_created_at" {+ type = "DateTime64(3)"}- column "computed_at" {+ column "inserted_at" {type = "DateTime64(6, 'UTC')"- default = "now()"+ default = "now64()"+ codec = "GCD, Default"}- column "expires_at" {- type = "Date"- default = "today() + toIntervalDay(7)"+ column "person_mode" {+ type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"}- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.marketing_costs_preaggregated"- replica_name = "{replica}-{shard}"- version_column = "computed_at"+ column "consumer_breadcrumbs" {+ type = "Array(String)"}- }-- table "sharded_marketing_touchpoints_preaggregated" {- order_by = ["team_id", "job_id", "person_id", "touchpoint_timestamp"]- partition_by = "toYYYYMMDD(expires_at)"- ttl = "expires_at"- settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"+ column "historical_migration" {+ type = "Bool"}- column "team_id" {- type = "Int64"+ column "total_event_size" {+ type = "UInt32"+ codec = "T64, Default"}- column "job_id" {- type = "UUID"+ column "captured_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now()"+ codec = "GCD, Default"}- column "person_id" {- type = "UUID"+ column "_partition" {+ type = "UInt64"+ codec = "T64, Default"}- column "touchpoint_timestamp" {- type = "DateTime64(6, 'UTC')"+ column "elements_chain_href" {+ type = "String"+ materialized = "EXTRACT(elements_chain, '(?::|\")href=\"(.*?)\"')"}- column "campaign_name" {- type = "String"+ column "elements_chain_texts" {+ type = "Array(String)"+ materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")text=\"(.*?)\"'))"}- column "source_name" {- type = "String"+ column "elements_chain_ids" {+ type = "Array(String)"+ materialized = "arrayDistinct(extractAll(elements_chain, '(?::|\")attr_id=\"(.*?)\"'))"}- column "medium_name" {- type = "String"+ column "elements_chain_elements" {+ type = "Array(Enum8('a'=1, 'button'=2, 'form'=3, 'input'=4, 'select'=5, 'textarea'=6, 'label'=7))"+ materialized = "arrayDistinct(extractAll(elements_chain, '(?:^|;)(a|button|form|input|select|textarea|label)(?:\\\\.|$|:)'))"}- column "content_name" {- type = "String"+ index "bloom_filter_distinct_id" {+ expr = "distinct_id"+ type = "bloom_filter"+ granularity = 1}- column "term_name" {- type = "String"+ index "bloom_filter_uuid" {+ expr = "uuid"+ type = "bloom_filter"+ granularity = 1}- column "referring_domain_name" {- type = "String"+ index "bloom_filter_person_id" {+ expr = "person_id"+ type = "bloom_filter"+ granularity = 1}- column "gclid_name" {- type = "String"+ index "minmax_captured_at" {+ expr = "captured_at"+ type = "minmax"+ granularity = 1}- column "fbclid_name" {- type = "String"+ index "minmax_kafka_timestamp" {+ expr = "_timestamp"+ type = "minmax"+ granularity = 1}- column "gad_source_name" {- type = "String"+ index "minmax_inserted_at" {+ expr = "inserted_at"+ type = "minmax"+ granularity = 1}- column "computed_at" {- type = "DateTime64(6, 'UTC')"- default = "now()"+ index "minmax_timestamp" {+ expr = "timestamp"+ type = "minmax"+ granularity = 1}- column "expires_at" {- type = "Date"- default = "today() + toIntervalDay(7)"+ index "minmax_historical_migration" {+ expr = "historical_migration"+ type = "minmax"+ granularity = 1+ }+ index "minmax_created_at" {+ expr = "created_at"+ type = "minmax"+ granularity = 1}engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.marketing_touchpoints_preaggregated"- replica_name = "{replica}-{shard}"- version_column = "computed_at"+ zoo_path = "/clickhouse/tables/{shard}/posthog.events_json"+ replica_name = "{replica}"+ version_column = "_timestamp"}}- table "sharded_performance_events" {- order_by = ["team_id", "toDate(timestamp)", "session_id", "pageview_id", "timestamp"]- partition_by = "toYYYYMM(timestamp)"- ttl = "toDate(timestamp) + toIntervalWeek(3)"+ table "sharded_events_recent" {+ order_by = ["team_id", "toStartOfHour(inserted_at)", "event", "cityHash64(distinct_id)", "cityHash64(uuid)"]+ partition_by = "toStartOfDay(inserted_at)"+ ttl = "toDate(inserted_at) + toIntervalDay(9)"settings = {- index_granularity = "8192"- }- column "uuid" {- type = "UUID"- }- column "session_id" {- type = "String"- }- column "window_id" {- type = "String"+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}- column "pageview_id" {- type = "String"+ column "uuid" {+ type = "UUID"}- column "distinct_id" {+ column "event" {type = "String"}- column "timestamp" {- type = "DateTime64(3)"- }- column "time_origin" {- type = "DateTime64(3, 'UTC')"- }- column "entry_type" {- type = "LowCardinality(String)"+ column "properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "name" {- type = "String"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"}column "team_id" {type = "Int64"}- column "current_url" {+ column "distinct_id" {type = "String"}- column "start_time" {- type = "Float64"- }- column "duration" {- type = "Float64"+ column "elements_chain" {+ type = "String"}- column "redirect_start" {- type = "Float64"+ column "created_at" {+ type = "DateTime64(6, 'UTC')"}- column "redirect_end" {- type = "Float64"+ column "person_id" {+ type = "UUID"}- column "worker_start" {- type = "Float64"+ column "person_created_at" {+ type = "DateTime64(3)"}- column "fetch_start" {- type = "Float64"+ column "person_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "domain_lookup_start" {- type = "Float64"+ column "group0_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "domain_lookup_end" {- type = "Float64"+ column "group1_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "connect_start" {- type = "Float64"+ column "group2_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "secure_connection_start" {- type = "Float64"+ column "group3_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "connect_end" {- type = "Float64"+ column "group4_properties" {+ type = "String"+ codec = "ZSTD(3)"}- column "request_start" {- type = "Float64"+ column "group0_created_at" {+ type = "DateTime64(3)"}- column "response_start" {- type = "Float64"+ column "group1_created_at" {+ type = "DateTime64(3)"}- column "response_end" {- type = "Float64"+ column "group2_created_at" {+ type = "DateTime64(3)"}- column "decoded_body_size" {- type = "Int64"+ column "group3_created_at" {+ type = "DateTime64(3)"}- column "encoded_body_size" {- type = "Int64"+ column "group4_created_at" {+ type = "DateTime64(3)"}- column "initiator_type" {- type = "LowCardinality(String)"+ column "person_mode" {+ type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"}- column "next_hop_protocol" {- type = "LowCardinality(String)"+ column "historical_migration" {+ type = "Bool"}- column "render_blocking_status" {- type = "LowCardinality(String)"+ column "_timestamp" {+ type = "DateTime"}- column "response_status" {- type = "Int64"+ column "_offset" {+ type = "UInt64"}- column "transfer_size" {- type = "Int64"+ column "inserted_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now64()"}- column "largest_contentful_paint_element" {- type = "String"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_events_recent"+ replica_name = "{replica}"+ version_column = "_timestamp"}- column "largest_contentful_paint_render_time" {- type = "Float64"+ }++ table "sharded_experiment_exposures_preaggregated" {+ order_by = ["team_id", "job_id", "entity_id", "breakdown_value"]+ partition_by = "toYYYYMMDD(expires_at)"+ ttl = "expires_at"+ settings = {+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}- column "largest_contentful_paint_load_time" {- type = "Float64"+ column "team_id" {+ type = "Int64"}- column "largest_contentful_paint_size" {- type = "Float64"+ column "job_id" {+ type = "UUID"}- column "largest_contentful_paint_id" {+ column "entity_id" {type = "String"}- column "largest_contentful_paint_url" {+ column "variant" {type = "String"}- column "dom_complete" {- type = "Float64"- }- column "dom_content_loaded_event" {- type = "Float64"- }- column "dom_interactive" {- type = "Float64"- }- column "load_event_end" {- type = "Float64"- }- column "load_event_start" {- type = "Float64"- }- column "redirect_count" {- type = "Int64"+ column "first_exposure_time" {+ type = "DateTime64(6, 'UTC')"}- column "navigation_type" {- type = "LowCardinality(String)"+ column "last_exposure_time" {+ type = "DateTime64(6, 'UTC')"}- column "unload_event_end" {- type = "Float64"+ column "exposure_event_uuid" {+ type = "UUID"}- column "unload_event_start" {- type = "Float64"+ column "exposure_session_id" {+ type = "String"}- column "_timestamp" {- type = "DateTime"+ column "breakdown_value" {+ type = "Array(String)"}- column "_offset" {- type = "UInt64"+ column "computed_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now()"}- column "_partition" {- type = "UInt64"+ column "expires_at" {+ type = "Date"+ default = "today() + toIntervalDay(7)"}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.performance_events"- replica_name = "{replica}"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.experiment_exposures_preaggregated"+ replica_name = "{replica}"+ version_column = "computed_at"}}- table "sharded_person_group_membership" {- order_by = ["team_id", "group_type_index", "group_key", "distinct_id"]+ table "sharded_experiment_metric_events_preaggregated" {+ order_by = ["team_id", "job_id", "entity_id", "timestamp", "event_uuid"]+ partition_by = "toYYYYMMDD(expires_at)"+ ttl = "expires_at"settings = {- index_granularity = "8192"- min_bytes_for_wide_part = "0"- min_rows_for_wide_part = "0"+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}column "team_id" {type = "Int64"}- column "group_type_index" {- type = "UInt8"+ column "job_id" {+ type = "UUID"}- column "group_key" {+ column "entity_id" {type = "String"}- column "distinct_id" {+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"+ }+ column "event_uuid" {+ type = "UUID"+ }+ column "session_id" {type = "String"}- column "first_seen" {- type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"+ column "numeric_value" {+ type = "Float64"+ default = "0"}- column "last_seen" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"+ column "steps" {+ type = "Array(UInt8)"+ default = "[]"}- index "idx_distinct_id" {- expr = "distinct_id"- type = "bloom_filter(0.01)"- granularity = 1+ column "computed_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now()"}- engine "replicated_aggregating_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_person_group_membership"- replica_name = "{replica}"+ column "expires_at" {+ type = "Date"+ default = "today() + toIntervalDay(7)"+ }+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/noshard/posthog.experiment_metric_events_preaggregated"+ replica_name = "{replica}-{shard}"+ version_column = "computed_at"}}- table "sharded_platform_alert_events" {- primary_key = ["team_id", "configuration_id", "alert_id", "occurred_at"]- order_by = ["team_id", "configuration_id", "alert_id", "occurred_at", "evaluation_key"]- partition_by = "toYYYYMM(occurred_at)"- ttl = "expires_at"+ table "sharded_flag_evaluations" {+ order_by = ["team_id", "flag_key", "toDate(timestamp)", "cityHash64(distinct_id)", "cityHash64(uuid)"]+ partition_by = "toYYYYMM(timestamp)"+ ttl = "toDate(timestamp) + toIntervalDay(90)"settings = {index_granularity = "8192"ttl_only_drop_parts = "1"}+ column "uuid" {+ type = "UUID"+ }+ column "event" {+ type = "LowCardinality(String)"+ }+ column "properties" {+ type = "String"+ }+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"+ }column "team_id" {type = "Int64"}- column "configuration_id" {- type = "UUID"+ column "distinct_id" {+ type = "String"}- column "alert_id" {+ column "created_at" {+ type = "DateTime64(6, 'UTC')"+ }+ column "person_id" {type = "UUID"}- column "grouping_key" {- type = "String"+ column "person_properties" {+ type = "String"+ default = "'{}'"}- column "evaluation_key" {- type = "String"+ column "person_created_at" {+ type = "DateTime64(3)"}- column "kind" {- type = "LowCardinality(String)"+ column "inserted_at" {+ type = "DateTime64(6, 'UTC')"+ default = "timestamp"}- column "alert_name" {- type = "String"+ column "person_mode" {+ type = "Enum8('full'=0, 'propertyless'=1, 'force_upgrade'=2)"}- column "previous_state" {- type = "LowCardinality(String)"+ column "$group_0" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_0'), '^\"|\"$', '')"+ comment = "column_materializer::$group_0"}- column "state" {- type = "LowCardinality(String)"+ column "$group_1" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_1'), '^\"|\"$', '')"+ comment = "column_materializer::$group_1"}- column "episode_started_at" {- type = "Nullable(DateTime64(6, 'UTC'))"+ column "$group_2" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_2'), '^\"|\"$', '')"+ comment = "column_materializer::$group_2"}- column "value" {- type = "Nullable(Float64)"+ column "$group_3" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_3'), '^\"|\"$', '')"+ comment = "column_materializer::$group_3"}- column "labels" {- type = "Map(String, String)"+ column "$group_4" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$group_4'), '^\"|\"$', '')"+ comment = "column_materializer::$group_4"}- column "condition_snapshot" {- type = "String"+ column "flag_key" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$feature_flag'), '^\"|\"$', '')"+ comment = "column_materializer::properties::$feature_flag"}- column "source_config_snapshot" {- type = "String"+ column "response" {+ type = "LowCardinality(String)"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$feature_flag_response'), '^\"|\"$', '')"+ comment = "column_materializer::properties::$feature_flag_response"}- column "query_duration_ms" {- type = "Nullable(UInt32)"+ column "session_id" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$session_id'), '^\"|\"$', '')"+ comment = "column_materializer::properties::$session_id"}- column "error_message" {- type = "String"+ column "request_id" {+ type = "String"+ default = "replaceRegexpAll(JSONExtractRaw(properties, '$feature_flag_request_id'), '^\"|\"$', '')"+ comment = "column_materializer::properties::$feature_flag_request_id"}- column "consecutive_failures" {- type = "UInt32"+ column "properties_group_custom" {+ type = "Map(String, String)"+ materialized = "mapSort(mapFilter((key, _) -> ((key NOT LIKE '$%') AND (key NOT IN ('token', 'distinct_id', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'gclid', 'gad_source', 'gclsrc', 'dclid', 'gbraid', 'wbraid', 'fbclid', 'msclkid', 'twclid', 'li_fat_id', 'mc_cid', 'igshid', 'ttclid', 'rdt_cid', 'epik', 'qclid', 'sccid', 'irclid', '_kx'))), CAST(JSONExtractKeysAndValues(properties, 'String'), 'Map(String, String)')))"}- column "muted_notification" {- type = "LowCardinality(String)"+ column "person_properties_map_custom" {+ type = "Map(String, String)"+ materialized = "mapSort(mapFilter((key, _) -> (key NOT LIKE '$%'), CAST(JSONExtractKeysAndValues(person_properties, 'String'), 'Map(String, String)')))"}- column "occurred_at" {- type = "DateTime64(6, 'UTC')"+ column "_timestamp" {+ type = "DateTime"}- column "source_kind" {- type = "LowCardinality(String)"+ column "_offset" {+ type = "UInt64"}- column "expires_at" {- type = "Date"- default = "today() + toIntervalDay(90)"+ column "_partition" {+ type = "UInt64"}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.platform_alert_events"- replica_name = "{replica}-{shard}"+ index "distinct_id_idx" {+ expr = "distinct_id"+ type = "bloom_filter(0.01)"+ granularity = 1+ }+ index "person_id_idx" {+ expr = "person_id"+ type = "bloom_filter(0.01)"+ granularity = 1+ }+ index "session_id_idx" {+ expr = "session_id"+ type = "bloom_filter(0.01)"+ granularity = 1+ }+ index "request_id_idx" {+ expr = "request_id"+ type = "bloom_filter(0.01)"+ granularity = 1+ }+ index "inserted_at_idx" {+ expr = "inserted_at"+ type = "minmax"+ granularity = 1+ }+ index "properties_group_custom_keys_bf" {+ expr = "mapKeys(properties_group_custom)"+ type = "bloom_filter"+ granularity = 1+ }+ index "properties_group_custom_values_bf" {+ expr = "mapValues(properties_group_custom)"+ type = "bloom_filter"+ granularity = 1+ }+ index "person_properties_map_custom_keys_bf" {+ expr = "mapKeys(person_properties_map_custom)"+ type = "bloom_filter"+ granularity = 1+ }+ index "person_properties_map_custom_values_bf" {+ expr = "mapValues(person_properties_map_custom)"+ type = "bloom_filter"+ granularity = 1+ }+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.flag_evaluations"+ replica_name = "{replica}"+ version_column = "_timestamp"}}- table "sharded_posthog_document_embeddings_buffer" {- order_by = ["inserted_at", "model_name", "cityHash64(document_id)"]- partition_by = "toDate(inserted_at)"- ttl = "inserted_at + toIntervalDay(1)"+ table "sharded_heatmaps" {+ order_by = ["type", "team_id", "toDate(timestamp)", "current_url", "viewport_width"]+ partition_by = "toYYYYMM(timestamp)"+ ttl = "toDate(timestamp) + toIntervalDay(90)"settings = {- index_granularity = "8192"- ttl_only_drop_parts = "1"+ index_granularity = "8192"+ }+ column "session_id" {+ type = "String"}column "team_id" {type = "Int64"}- column "product" {- type = "LowCardinality(String)"+ column "distinct_id" {+ type = "String"}- column "document_type" {- type = "LowCardinality(String)"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "model_name" {- type = "LowCardinality(String)"+ column "x" {+ type = "Int16"}- column "rendering" {- type = "LowCardinality(String)"+ column "y" {+ type = "Int16"}- column "document_id" {- type = "String"+ column "scale_factor" {+ type = "Int16"}- column "timestamp" {- type = "DateTime64(3, 'UTC')"+ column "viewport_width" {+ type = "Int16"}- column "inserted_at" {- type = "DateTime64(3, 'UTC')"+ column "viewport_height" {+ type = "Int16"}- column "content" {- type = "String"- default = "''"+ column "pointer_target_fixed" {+ type = "Bool"}- column "metadata" {- type = "String"- default = "'{}'"+ column "current_url" {+ type = "String"}- column "embedding" {- type = "Array(Float64)"+ column "type" {+ type = "LowCardinality(String)"}column "_timestamp" {type = "DateTime"@@ -13309,52 +11902,33 @@ SQLcolumn "_partition" {type = "UInt64"}- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_posthog_document_embeddings_buffer"- replica_name = "{replica}"- version_column = "inserted_at"+ engine "replicated_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.heatmaps"+ replica_name = "{replica}"}}- table "sharded_posthog_document_embeddings_text_embedding_3_large_3072" {- order_by = ["team_id", "toDate(timestamp)", "product", "document_type", "rendering", "cityHash64(document_id)"]- partition_by = "toMonday(timestamp)"- ttl = "timestamp + toIntervalMonth(3)"+ table "sharded_ingestion_warnings" {+ order_by = ["team_id", "toHour(timestamp)", "type", "source", "timestamp"]+ partition_by = "toYYYYMMDD(timestamp)"settings = {- index_granularity = "512"- ttl_only_drop_parts = "1"+ index_granularity = "8192"}column "team_id" {type = "Int64"}- column "product" {- type = "LowCardinality(String)"- }- column "document_type" {- type = "LowCardinality(String)"- }- column "rendering" {- type = "LowCardinality(String)"- }- column "document_id" {- type = "String"- }- column "timestamp" {- type = "DateTime64(3, 'UTC')"- }- column "inserted_at" {- type = "DateTime64(3, 'UTC')"+ column "source" {+ type = "LowCardinality(String)"}- column "content" {- type = "String"- default = "''"+ column "type" {+ type = "String"}- column "metadata" {- type = "String"- default = "'{}'"+ column "details" {+ type = "String"+ codec = "ZSTD(3)"}- column "embedding" {- type = "Array(Float64)"+ column "timestamp" {+ type = "DateTime64(6, 'UTC')"}column "_timestamp" {type = "DateTime"@@ -13365,70 +11939,40 @@ SQLcolumn "_partition" {type = "UInt64"}- index "kafka_timestamp_minmax_sharded_posthog_document_embeddings_text_embedding_3_large_3072" {- expr = "_timestamp"- type = "minmax"- granularity = 3- }- index "embedding_idx_l2" {- expr = "embedding"- type = "vector_similarity('hnsw', 'L2Distance', 3072)"- granularity = 100000000- }- index "embedding_idx_cosine" {- expr = "embedding"- type = "vector_similarity('hnsw', 'cosineDistance', 3072)"- granularity = 100000000- }- constraint "embedding_dimension_check" {- check = "length(embedding) = 3072"- }- engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_posthog_document_embeddings_text_embedding_3_large_3072"- replica_name = "{replica}"- version_column = "inserted_at"+ engine "replicated_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_ingestion_warnings"+ replica_name = "{replica}"}}- table "sharded_posthog_document_embeddings_text_embedding_3_small_1536" {- order_by = ["team_id", "toDate(timestamp)", "product", "document_type", "rendering", "cityHash64(document_id)"]- partition_by = "toMonday(timestamp)"- ttl = "timestamp + toIntervalMonth(3)"+ table "sharded_log_entries" {+ order_by = ["team_id", "log_source", "log_source_id", "instance_id", "timestamp"]+ partition_by = "toYYYYMMDD(timestamp)"+ ttl = "toDate(timestamp) + toIntervalDay(90)"settings = {- index_granularity = "512"+ index_granularity = "1024"ttl_only_drop_parts = "1"}column "team_id" {- type = "Int64"- }- column "product" {- type = "LowCardinality(String)"+ type = "UInt64"}- column "document_type" {+ column "log_source" {type = "LowCardinality(String)"}- column "rendering" {- type = "LowCardinality(String)"+ column "log_source_id" {+ type = "String"}- column "document_id" {+ column "instance_id" {type = "String"}column "timestamp" {- type = "DateTime64(3, 'UTC')"- }- column "inserted_at" {- type = "DateTime64(3, 'UTC')"- }- column "content" {- type = "String"- default = "''"+ type = "DateTime64(6, 'UTC')"}- column "metadata" {- type = "String"- default = "'{}'"+ column "level" {+ type = "LowCardinality(String)"}- column "embedding" {- type = "Array(Float64)"+ column "message" {+ type = "String"}column "_timestamp" {type = "DateTime"@@ -13436,40 +11980,20 @@ SQLcolumn "_offset" {type = "UInt64"}- column "_partition" {- type = "UInt64"- }- index "kafka_timestamp_minmax_sharded_posthog_document_embeddings_text_embedding_3_small_1536" {- expr = "_timestamp"- type = "minmax"- granularity = 3- }- index "embedding_idx_l2" {- expr = "embedding"- type = "vector_similarity('hnsw', 'L2Distance', 1536)"- granularity = 100000000- }- index "embedding_idx_cosine" {- expr = "embedding"- type = "vector_similarity('hnsw', 'cosineDistance', 1536)"- granularity = 100000000- }- constraint "embedding_dimension_check" {- check = "length(embedding) = 1536"- }engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_posthog_document_embeddings_text_embedding_3_small_1536"+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_log_entries"replica_name = "{replica}"- version_column = "inserted_at"+ version_column = "_timestamp"}}- table "sharded_preaggregation_results" {- order_by = ["team_id", "job_id", "time_window_start", "breakdown_value"]- partition_by = "toYYYYMM(time_window_start)"+ table "sharded_marketing_conversions_preaggregated" {+ order_by = ["team_id", "job_id", "person_id", "conversion_timestamp"]+ partition_by = "toYYYYMMDD(expires_at)"ttl = "expires_at"settings = {- index_granularity = "8192"+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}column "team_id" {type = "Int64"@@ -13477,757 +12001,792 @@ SQLcolumn "job_id" {type = "UUID"}- column "time_window_start" {- type = "DateTime64(6, 'UTC')"- }- column "expires_at" {- type = "DateTime64(6, 'UTC')"- default = "now() + toIntervalDay(7)"+ column "person_id" {+ type = "UUID"}- column "breakdown_value" {- type = "Array(String)"+ column "conversion_timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "uniq_exact_state" {- type = "AggregateFunction(uniqExact, UUID)"+ column "conversion_math_value" {+ type = "Float64"}- engine "replicated_aggregating_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.preaggregation_results"- replica_name = "{replica}"+ column "session_id" {+ type = "String"}- }-- table "sharded_precalculated_events" {- order_by = ["team_id", "condition", "date", "distinct_id", "uuid"]- partition_by = "toYYYYMM(date)"- settings = {- index_granularity = "8192"+ column "campaign_name" {+ type = "String"}- column "team_id" {- type = "Int64"+ column "source_name" {+ type = "String"}- column "date" {- type = "Date"+ column "medium_name" {+ type = "String"}- column "distinct_id" {+ column "content_name" {type = "String"}- column "person_id" {- type = "UUID"+ column "term_name" {+ type = "String"}- column "condition" {+ column "referring_domain_name" {type = "String"}- column "uuid" {- type = "UUID"+ column "gclid_name" {+ type = "String"}- column "source" {+ column "fbclid_name" {type = "String"}- column "_timestamp" {- type = "DateTime64(6)"+ column "gad_source_name" {+ type = "String"}- column "_partition" {- type = "UInt64"+ column "computed_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now()"}- column "_offset" {- type = "UInt64"+ column "expires_at" {+ type = "Date"+ default = "today() + toIntervalDay(7)"}engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_precalculated_events"- replica_name = "{replica}"- version_column = "_timestamp"+ zoo_path = "/clickhouse/tables/noshard/posthog.marketing_conversions_preaggregated"+ replica_name = "{replica}-{shard}"+ version_column = "computed_at"}}- table "sharded_precalculated_person_properties" {- order_by = ["team_id", "condition", "distinct_id"]+ table "sharded_marketing_costs_preaggregated" {+ order_by = ["team_id", "job_id", "source_name", "grain", "campaign_id", "ad_group_id", "ad_id", "cost_date"]+ partition_by = "toYYYYMMDD(expires_at)"+ ttl = "expires_at"settings = {- index_granularity = "8192"+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}column "team_id" {type = "Int64"}- column "distinct_id" {+ column "job_id" {+ type = "UUID"+ }+ column "source_id" {type = "String"}- column "person_id" {- type = "UUID"+ column "source_name" {+ type = "String"}- column "condition" {+ column "grain" {+ type = "LowCardinality(String)"+ }+ column "match_key" {type = "String"}- column "matches" {- type = "Bool"+ column "campaign_id" {+ type = "String"}- column "source" {+ column "campaign_name" {type = "String"}- column "_timestamp" {- type = "DateTime64(6)"+ column "ad_group_id" {+ type = "String"}- column "_offset" {- type = "UInt64"+ column "ad_group_name" {+ type = "String"+ }+ column "ad_id" {+ type = "String"+ }+ column "ad_name" {+ type = "String"+ }+ column "cost_date" {+ type = "Date"+ }+ column "cost" {+ type = "Float64"+ }+ column "clicks" {+ type = "Float64"+ }+ column "impressions" {+ type = "Float64"+ }+ column "reported_conversions" {+ type = "Float64"+ }+ column "reported_conversion_value" {+ type = "Float64"+ }+ column "computed_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now()"+ }+ column "expires_at" {+ type = "Date"+ default = "today() + toIntervalDay(7)"}engine "replicated_replacing_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_precalculated_person_properties"- replica_name = "{replica}"- version_column = "_timestamp"+ zoo_path = "/clickhouse/tables/noshard/posthog.marketing_costs_preaggregated"+ replica_name = "{replica}-{shard}"+ version_column = "computed_at"}}- table "sharded_query_log_archive" {- order_by = ["team_id", "event_date", "event_time", "query_id"]- partition_by = "toYYYYMM(event_date)"+ table "sharded_marketing_touchpoints_preaggregated" {+ order_by = ["team_id", "job_id", "person_id", "touchpoint_timestamp"]+ partition_by = "toYYYYMMDD(expires_at)"+ ttl = "expires_at"settings = {- index_granularity = "8192"- object_serialization_version = "v3"- object_shared_data_serialization_version = "map_with_buckets"- }- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}- column "query_id" {- type = "String"+ column "team_id" {+ type = "Int64"}- column "initial_query_id" {- type = "String"+ column "job_id" {+ type = "UUID"}- column "is_initial_query" {- type = "UInt8"+ column "person_id" {+ type = "UUID"}- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"+ column "touchpoint_timestamp" {+ type = "DateTime64(6, 'UTC')"}- column "event_date" {- type = "Date"+ column "campaign_name" {+ type = "String"}- column "event_time" {- type = "DateTime"+ column "source_name" {+ type = "String"}- column "event_time_microseconds" {- type = "DateTime64(6)"+ column "medium_name" {+ type = "String"}- column "query_start_time" {- type = "DateTime"+ column "content_name" {+ type = "String"}- column "query_start_time_microseconds" {- type = "DateTime64(6)"+ column "term_name" {+ type = "String"}- column "query_duration_ms" {- type = "UInt64"+ column "referring_domain_name" {+ type = "String"}- column "read_rows" {- type = "UInt64"+ column "gclid_name" {+ type = "String"}- column "read_bytes" {- type = "UInt64"+ column "fbclid_name" {+ type = "String"}- column "written_rows" {- type = "UInt64"+ column "gad_source_name" {+ type = "String"}- column "written_bytes" {- type = "UInt64"+ column "computed_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now()"}- column "result_rows" {- type = "UInt64"+ column "expires_at" {+ type = "Date"+ default = "today() + toIntervalDay(7)"}- column "result_bytes" {- type = "UInt64"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/noshard/posthog.marketing_touchpoints_preaggregated"+ replica_name = "{replica}-{shard}"+ version_column = "computed_at"}- column "memory_usage" {- type = "UInt64"+ }++ table "sharded_performance_events" {+ order_by = ["team_id", "toDate(timestamp)", "session_id", "pageview_id", "timestamp"]+ partition_by = "toYYYYMM(timestamp)"+ ttl = "toDate(timestamp) + toIntervalWeek(3)"+ settings = {+ index_granularity = "8192"}- column "peak_threads_usage" {- type = "UInt64"+ column "uuid" {+ type = "UUID"}- column "current_database" {- type = "LowCardinality(String)"+ column "session_id" {+ type = "String"}- column "query" {+ column "window_id" {type = "String"}- column "formatted_query" {+ column "pageview_id" {type = "String"}- column "normalized_query_hash" {- type = "UInt64"+ column "distinct_id" {+ type = "String"}- column "query_kind" {- type = "LowCardinality(String)"+ column "timestamp" {+ type = "DateTime64(3)"}- column "exception_code" {- type = "Int32"+ column "time_origin" {+ type = "DateTime64(3, 'UTC')"}- column "exception" {- type = "String"+ column "entry_type" {+ type = "LowCardinality(String)"}- column "stack_trace" {+ column "name" {type = "String"}column "team_id" {type = "Int64"}- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"+ column "current_url" {+ type = "String"}- column "ProfileEvents" {- type = "Map(String, UInt64)"+ column "start_time" {+ type = "Float64"}- column "exception_name" {- type = "String"- alias = "errorCodeToName(exception_code)"+ column "duration" {+ type = "Float64"}- column "ProfileEvents_RealTimeMicroseconds" {- type = "Int64"- alias = "ProfileEvents['RealTimeMicroseconds']"+ column "redirect_start" {+ type = "Float64"}- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "Int64"- alias = "ProfileEvents['OSCPUVirtualTimeMicroseconds']"+ column "redirect_end" {+ type = "Float64"}- column "ProfileEvents_S3Clients" {- type = "Int64"- alias = "ProfileEvents['S3Clients']"+ column "worker_start" {+ type = "Float64"}- column "ProfileEvents_S3DeleteObjects" {- type = "Int64"- alias = "ProfileEvents['S3DeleteObjects']"+ column "fetch_start" {+ type = "Float64"}- column "ProfileEvents_S3CopyObject" {- type = "Int64"- alias = "ProfileEvents['S3CopyObject']"+ column "domain_lookup_start" {+ type = "Float64"}- column "ProfileEvents_S3ListObjects" {- type = "Int64"- alias = "ProfileEvents['S3ListObjects']"+ column "domain_lookup_end" {+ type = "Float64"}- column "ProfileEvents_S3HeadObject" {- type = "Int64"- alias = "ProfileEvents['S3HeadObject']"+ column "connect_start" {+ type = "Float64"}- column "ProfileEvents_S3GetObjectAttributes" {- type = "Int64"- alias = "ProfileEvents['S3GetObjectAttributes']"+ column "secure_connection_start" {+ type = "Float64"}- column "ProfileEvents_S3CreateMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3CreateMultipartUpload']"+ column "connect_end" {+ type = "Float64"}- column "ProfileEvents_S3UploadPartCopy" {- type = "Int64"- alias = "ProfileEvents['S3UploadPartCopy']"+ column "request_start" {+ type = "Float64"}- column "ProfileEvents_S3UploadPart" {- type = "Int64"- alias = "ProfileEvents['S3UploadPart']"+ column "response_start" {+ type = "Float64"}- column "ProfileEvents_S3AbortMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3AbortMultipartUpload']"+ column "response_end" {+ type = "Float64"}- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3CompleteMultipartUpload']"+ column "decoded_body_size" {+ type = "Int64"}- column "ProfileEvents_S3PutObject" {- type = "Int64"- alias = "ProfileEvents['S3PutObject']"+ column "encoded_body_size" {+ type = "Int64"}- column "ProfileEvents_S3GetObject" {- type = "Int64"- alias = "ProfileEvents['S3GetObject']"+ column "initiator_type" {+ type = "LowCardinality(String)"}- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "Int64"- alias = "ProfileEvents['ReadBufferFromS3Bytes']"+ column "next_hop_protocol" {+ type = "LowCardinality(String)"}- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "Int64"- alias = "ProfileEvents['WriteBufferFromS3Bytes']"+ column "render_blocking_status" {+ type = "LowCardinality(String)"}- column "lc_workflow" {- type = "LowCardinality(String)"- alias = "log_comment.workflow"+ column "response_status" {+ type = "Int64"}- column "lc_kind" {- type = "LowCardinality(String)"- alias = "log_comment.kind"+ column "transfer_size" {+ type = "Int64"}- column "lc_id" {- type = "String"- alias = "CAST(log_comment.id, 'String')"+ column "largest_contentful_paint_element" {+ type = "String"}- column "lc_route_id" {- type = "String"- alias = "CAST(log_comment.route_id, 'String')"+ column "largest_contentful_paint_render_time" {+ type = "Float64"}- column "lc_access_method" {- type = "LowCardinality(String)"- alias = "log_comment.access_method"+ column "largest_contentful_paint_load_time" {+ type = "Float64"}- column "lc_api_key_label" {- type = "String"- alias = "CAST(log_comment.api_key_label, 'String')"+ column "largest_contentful_paint_size" {+ type = "Float64"}- column "lc_api_key_mask" {- type = "String"- alias = "CAST(log_comment.api_key_mask, 'String')"+ column "largest_contentful_paint_id" {+ type = "String"}- column "lc_query_type" {- type = "LowCardinality(String)"- alias = "log_comment.query_type"+ column "largest_contentful_paint_url" {+ type = "String"}- column "lc_product" {- type = "LowCardinality(String)"- alias = "log_comment.product"+ column "dom_complete" {+ type = "Float64"+ }+ column "dom_content_loaded_event" {+ type = "Float64"+ }+ column "dom_interactive" {+ type = "Float64"+ }+ column "load_event_end" {+ type = "Float64"+ }+ column "load_event_start" {+ type = "Float64"}- column "lc_chargeable" {- type = "Bool"- alias = "log_comment.chargeable"+ column "redirect_count" {+ type = "Int64"}- column "lc_name" {- type = "String"- alias = "CAST(log_comment.name, 'String')"+ column "navigation_type" {+ type = "LowCardinality(String)"}- column "lc_request_name" {- type = "String"- alias = "CAST(log_comment.request_name, 'String')"+ column "unload_event_end" {+ type = "Float64"}- column "lc_client_query_id" {- type = "String"- alias = "CAST(log_comment.client_query_id, 'String')"+ column "unload_event_start" {+ type = "Float64"}- column "lc_org_id" {- type = "String"- alias = "CAST(log_comment.org_id, 'String')"+ column "_timestamp" {+ type = "DateTime"}- column "lc_user_id" {- type = "Int64"- alias = "log_comment.user_id"+ column "_offset" {+ type = "UInt64"}- column "lc_is_impersonated" {- type = "Bool"- alias = "log_comment.is_impersonated"+ column "_partition" {+ type = "UInt64"}- column "lc_session_id" {- type = "String"- alias = "CAST(log_comment.session_id, 'String')"+ engine "replicated_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.performance_events"+ replica_name = "{replica}"}- column "lc_dashboard_id" {- type = "Int64"- alias = "log_comment.dashboard_id"+ }++ table "sharded_person_group_membership" {+ order_by = ["team_id", "group_type_index", "group_key", "distinct_id"]+ settings = {+ index_granularity = "8192"+ min_bytes_for_wide_part = "0"+ min_rows_for_wide_part = "0"}- column "lc_insight_id" {- type = "Int64"- alias = "log_comment.insight_id"+ column "team_id" {+ type = "Int64"}- column "lc_cohort_id" {- type = "Int64"- alias = "log_comment.cohort_id"+ column "group_type_index" {+ type = "UInt8"}- column "lc_batch_export_id" {- type = "String"- alias = "CAST(log_comment.batch_export_id, 'String')"+ column "group_key" {+ type = "String"}- column "lc_experiment_id" {- type = "Int64"- alias = "log_comment.experiment_id"+ column "distinct_id" {+ type = "String"}- column "lc_experiment_feature_flag_key" {- type = "String"- alias = "CAST(log_comment.experiment_feature_flag_key, 'String')"+ column "first_seen" {+ type = "SimpleAggregateFunction(min, DateTime64(6, 'UTC'))"}- column "lc_alert_config_id" {- type = "String"- alias = "CAST(log_comment.alert_config_id, 'String')"+ column "last_seen" {+ type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"}- column "lc_feature" {- type = "LowCardinality(String)"- alias = "log_comment.feature"+ index "idx_distinct_id" {+ expr = "distinct_id"+ type = "bloom_filter(0.01)"+ granularity = 1}- column "lc_table_id" {- type = "String"- alias = "CAST(log_comment.table_id, 'String')"+ engine "replicated_aggregating_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_person_group_membership"+ replica_name = "{replica}"}- column "lc_warehouse_query" {- type = "Bool"- alias = "log_comment.warehouse_query"+ }++ table "sharded_platform_alert_events" {+ primary_key = ["team_id", "configuration_id", "alert_id", "occurred_at"]+ order_by = ["team_id", "configuration_id", "alert_id", "occurred_at", "evaluation_key"]+ partition_by = "toYYYYMM(occurred_at)"+ ttl = "expires_at"+ settings = {+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}- column "lc_person_on_events_mode" {- type = "LowCardinality(String)"- alias = "log_comment.person_on_events_mode"+ column "team_id" {+ type = "Int64"}- column "lc_service_name" {- type = "String"- alias = "CAST(log_comment.service_name, 'String')"+ column "configuration_id" {+ type = "UUID"}- column "lc_workload" {- type = "LowCardinality(String)"- alias = "log_comment.workload"+ column "alert_id" {+ type = "UUID"}- column "lc_query__kind" {- type = "LowCardinality(String)"- alias = "if(JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'kind'), JSONExtractString(toString(log_comment), 'query', 'kind'))"+ column "grouping_key" {+ type = "String"}- column "lc_query__query" {- type = "String"- alias = "multiIf(NOT is_initial_query, '', JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'), JSONExtractString(toString(log_comment), 'query', 'query'))"+ column "evaluation_key" {+ type = "String"}- column "lc_query" {- type = "String"- alias = "if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), '')"+ column "kind" {+ type = "LowCardinality(String)"}- column "lc_temporal__workflow_namespace" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_namespace`, 'String')"+ column "alert_name" {+ type = "String"}- column "lc_temporal__workflow_type" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_type`, 'String')"+ column "previous_state" {+ type = "LowCardinality(String)"}- column "lc_temporal__workflow_id" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_id`, 'String')"+ column "state" {+ type = "LowCardinality(String)"}- column "lc_temporal__workflow_run_id" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_run_id`, 'String')"+ column "episode_started_at" {+ type = "Nullable(DateTime64(6, 'UTC'))"}- column "lc_temporal__activity_type" {- type = "String"- alias = "CAST(log_comment.`temporal.activity_type`, 'String')"+ column "value" {+ type = "Nullable(Float64)"}- column "lc_temporal__activity_id" {- type = "String"- alias = "CAST(log_comment.`temporal.activity_id`, 'String')"+ column "labels" {+ type = "Map(String, String)"}- column "lc_temporal__attempt" {- type = "Int64"- alias = "log_comment.`temporal.attempt`"+ column "condition_snapshot" {+ type = "String"}- column "lc_dagster__job_name" {- type = "String"- alias = "CAST(log_comment.`dagster.job_name`, 'String')"+ column "source_config_snapshot" {+ type = "String"}- column "lc_dagster__run_id" {- type = "String"- alias = "CAST(log_comment.`dagster.run_id`, 'String')"+ column "query_duration_ms" {+ type = "Nullable(UInt32)"}- column "lc_dagster__owner" {- type = "String"- alias = "CAST(log_comment.`dagster.tags.owner`, 'String')"+ column "error_message" {+ type = "String"}- column "lc_modifiers" {- type = "String"- alias = "if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), '')"+ column "consecutive_failures" {+ type = "UInt32"}- column "lc_plan_fingerprint" {- type = "String"- alias = "ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), '')"+ column "muted_notification" {+ type = "LowCardinality(String)"}- column "lc_estimated_rows" {- type = "Int64"- alias = "ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0)"+ column "occurred_at" {+ type = "DateTime64(6, 'UTC')"}- column "lc_estimated_bytes" {- type = "Int64"- alias = "ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0)"+ column "source_kind" {+ type = "LowCardinality(String)"+ }+ column "expires_at" {+ type = "Date"+ default = "today() + toIntervalDay(90)"}engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.sharded_query_log_archive"+ zoo_path = "/clickhouse/tables/noshard/posthog.platform_alert_events"replica_name = "{replica}-{shard}"}}- table "sharded_query_log_archive_old" {- order_by = ["team_id", "event_date", "event_time", "query_id"]- partition_by = "toYYYYMM(event_date)"+ table "sharded_posthog_document_embeddings_buffer" {+ order_by = ["inserted_at", "model_name", "cityHash64(document_id)"]+ partition_by = "toDate(inserted_at)"+ ttl = "inserted_at + toIntervalDay(1)"settings = {- index_granularity = "8192"+ index_granularity = "8192"+ ttl_only_drop_parts = "1"}- column "hostname" {+ column "team_id" {+ type = "Int64"+ }+ column "product" {type = "LowCardinality(String)"}- column "user" {+ column "document_type" {type = "LowCardinality(String)"}- column "query_id" {- type = "String"+ column "model_name" {+ type = "LowCardinality(String)"}- column "initial_query_id" {+ column "rendering" {+ type = "LowCardinality(String)"+ }+ column "document_id" {type = "String"}- column "is_initial_query" {- type = "UInt8"+ column "timestamp" {+ type = "DateTime64(3, 'UTC')"}- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"+ column "inserted_at" {+ type = "DateTime64(3, 'UTC')"}- column "event_date" {- type = "Date"+ column "content" {+ type = "String"+ default = "''"}- column "event_time" {- type = "DateTime"+ column "metadata" {+ type = "String"+ default = "'{}'"}- column "event_time_microseconds" {- type = "DateTime64(6)"+ column "embedding" {+ type = "Array(Float64)"}- column "query_start_time" {+ column "_timestamp" {type = "DateTime"}- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {+ column "_offset" {type = "UInt64"}- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {+ column "_partition" {type = "UInt64"}- column "query_kind" {- type = "LowCardinality(String)"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_posthog_document_embeddings_buffer"+ replica_name = "{replica}"+ version_column = "inserted_at"}- column "exception_code" {- type = "Int32"+ }++ table "sharded_posthog_document_embeddings_text_embedding_3_large_3072" {+ order_by = ["team_id", "toDate(timestamp)", "product", "document_type", "rendering", "cityHash64(document_id)"]+ partition_by = "toMonday(timestamp)"+ ttl = "timestamp + toIntervalMonth(3)"+ settings = {+ index_granularity = "512"+ ttl_only_drop_parts = "1"}- column "exception_name" {- type = "String"- alias = "errorCodeToName(exception_code)"+ column "team_id" {+ type = "Int64"}- column "exception" {- type = "String"+ column "product" {+ type = "LowCardinality(String)"}- column "stack_trace" {- type = "String"+ column "document_type" {+ type = "LowCardinality(String)"}- column "ProfileEvents_RealTimeMicroseconds" {- type = "Int64"+ column "rendering" {+ type = "LowCardinality(String)"}- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "Int64"+ column "document_id" {+ type = "String"}- column "ProfileEvents_S3Clients" {- type = "Int64"+ column "timestamp" {+ type = "DateTime64(3, 'UTC')"}- column "ProfileEvents_S3DeleteObjects" {- type = "Int64"+ column "inserted_at" {+ type = "DateTime64(3, 'UTC')"}- column "ProfileEvents_S3CopyObject" {- type = "Int64"+ column "content" {+ type = "String"+ default = "''"}- column "ProfileEvents_S3ListObjects" {- type = "Int64"+ column "metadata" {+ type = "String"+ default = "'{}'"}- column "ProfileEvents_S3HeadObject" {- type = "Int64"+ column "embedding" {+ type = "Array(Float64)"}- column "ProfileEvents_S3GetObjectAttributes" {- type = "Int64"+ column "_timestamp" {+ type = "DateTime"}- column "ProfileEvents_S3CreateMultipartUpload" {- type = "Int64"+ column "_offset" {+ type = "UInt64"}- column "ProfileEvents_S3UploadPartCopy" {- type = "Int64"+ column "_partition" {+ type = "UInt64"}- column "ProfileEvents_S3UploadPart" {- type = "Int64"+ index "kafka_timestamp_minmax_sharded_posthog_document_embeddings_text_embedding_3_large_3072" {+ expr = "_timestamp"+ type = "minmax"+ granularity = 3}- column "ProfileEvents_S3AbortMultipartUpload" {- type = "Int64"+ index "embedding_idx_l2" {+ expr = "embedding"+ type = "vector_similarity('hnsw', 'L2Distance', 3072)"+ granularity = 100000000}- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "Int64"+ index "embedding_idx_cosine" {+ expr = "embedding"+ type = "vector_similarity('hnsw', 'cosineDistance', 3072)"+ granularity = 100000000}- column "ProfileEvents_S3PutObject" {- type = "Int64"+ constraint "embedding_dimension_check" {+ check = "length(embedding) = 3072"}- column "ProfileEvents_S3GetObject" {- type = "Int64"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_posthog_document_embeddings_text_embedding_3_large_3072"+ replica_name = "{replica}"+ version_column = "inserted_at"}- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "Int64"+ }++ table "sharded_posthog_document_embeddings_text_embedding_3_small_1536" {+ order_by = ["team_id", "toDate(timestamp)", "product", "document_type", "rendering", "cityHash64(document_id)"]+ partition_by = "toMonday(timestamp)"+ ttl = "timestamp + toIntervalMonth(3)"+ settings = {+ index_granularity = "512"+ ttl_only_drop_parts = "1"}- column "ProfileEvents_WriteBufferFromS3Bytes" {+ column "team_id" {type = "Int64"}- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- column "lc_workflow" {+ column "product" {type = "LowCardinality(String)"}- column "lc_kind" {+ column "document_type" {type = "LowCardinality(String)"}- column "lc_id" {- type = "String"- }- column "lc_route_id" {- type = "String"- }- column "lc_access_method" {+ column "rendering" {type = "LowCardinality(String)"}- column "lc_api_key_label" {+ column "document_id" {type = "String"}- column "lc_api_key_mask" {- type = "String"+ column "timestamp" {+ type = "DateTime64(3, 'UTC')"}- column "lc_query_type" {- type = "LowCardinality(String)"+ column "inserted_at" {+ type = "DateTime64(3, 'UTC')"}- column "lc_product" {- type = "LowCardinality(String)"+ column "content" {+ type = "String"+ default = "''"}- column "lc_chargeable" {- type = "Bool"+ column "metadata" {+ type = "String"+ default = "'{}'"}- column "lc_name" {- type = "String"+ column "embedding" {+ type = "Array(Float64)"}- column "lc_request_name" {- type = "String"+ column "_timestamp" {+ type = "DateTime"}- column "lc_client_query_id" {- type = "String"+ column "_offset" {+ type = "UInt64"}- column "lc_org_id" {- type = "String"+ column "_partition" {+ type = "UInt64"}- column "team_id" {- type = "Int64"+ index "kafka_timestamp_minmax_sharded_posthog_document_embeddings_text_embedding_3_small_1536" {+ expr = "_timestamp"+ type = "minmax"+ granularity = 3}- column "lc_user_id" {- type = "Int64"+ index "embedding_idx_l2" {+ expr = "embedding"+ type = "vector_similarity('hnsw', 'L2Distance', 1536)"+ granularity = 100000000}- column "lc_is_impersonated" {- type = "Bool"+ index "embedding_idx_cosine" {+ expr = "embedding"+ type = "vector_similarity('hnsw', 'cosineDistance', 1536)"+ granularity = 100000000}- column "lc_session_id" {- type = "String"+ constraint "embedding_dimension_check" {+ check = "length(embedding) = 1536"}- column "lc_dashboard_id" {- type = "Int64"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_posthog_document_embeddings_text_embedding_3_small_1536"+ replica_name = "{replica}"+ version_column = "inserted_at"}- column "lc_insight_id" {- type = "Int64"+ }++ table "sharded_preaggregation_results" {+ order_by = ["team_id", "job_id", "time_window_start", "breakdown_value"]+ partition_by = "toYYYYMM(time_window_start)"+ ttl = "expires_at"+ settings = {+ index_granularity = "8192"}- column "lc_cohort_id" {+ column "team_id" {type = "Int64"}- column "lc_batch_export_id" {- type = "String"+ column "job_id" {+ type = "UUID"}- column "lc_experiment_id" {- type = "Int64"+ column "time_window_start" {+ type = "DateTime64(6, 'UTC')"}- column "lc_experiment_feature_flag_key" {- type = "String"+ column "expires_at" {+ type = "DateTime64(6, 'UTC')"+ default = "now() + toIntervalDay(7)"}- column "lc_alert_config_id" {- type = "String"+ column "breakdown_value" {+ type = "Array(String)"}- column "lc_feature" {- type = "LowCardinality(String)"+ column "uniq_exact_state" {+ type = "AggregateFunction(uniqExact, UUID)"}- column "lc_table_id" {- type = "String"+ engine "replicated_aggregating_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.preaggregation_results"+ replica_name = "{replica}"}- column "lc_warehouse_query" {- type = "Bool"+ }++ table "sharded_precalculated_events" {+ order_by = ["team_id", "condition", "date", "distinct_id", "uuid"]+ partition_by = "toYYYYMM(date)"+ settings = {+ index_granularity = "8192"}- column "lc_person_on_events_mode" {- type = "LowCardinality(String)"+ column "team_id" {+ type = "Int64"}- column "lc_service_name" {- type = "String"+ column "date" {+ type = "Date"}- column "lc_workload" {- type = "LowCardinality(String)"+ column "distinct_id" {+ type = "String"}- column "lc_query__kind" {- type = "LowCardinality(String)"+ column "person_id" {+ type = "UUID"}- column "lc_query__query" {+ column "condition" {type = "String"}- column "lc_query" {- type = "String"+ column "uuid" {+ type = "UUID"}- column "lc_temporal__workflow_namespace" {+ column "source" {type = "String"}- column "lc_temporal__workflow_type" {- type = "String"+ column "_timestamp" {+ type = "DateTime64(6)"}- column "lc_temporal__workflow_id" {- type = "String"+ column "_partition" {+ type = "UInt64"}- column "lc_temporal__workflow_run_id" {- type = "String"+ column "_offset" {+ type = "UInt64"}- column "lc_temporal__activity_type" {- type = "String"+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_precalculated_events"+ replica_name = "{replica}"+ version_column = "_timestamp"}- column "lc_temporal__activity_id" {- type = "String"+ }++ table "sharded_precalculated_person_properties" {+ order_by = ["team_id", "condition", "distinct_id"]+ settings = {+ index_granularity = "8192"}- column "lc_temporal__attempt" {+ column "team_id" {type = "Int64"}- column "lc_dagster__job_name" {+ column "distinct_id" {type = "String"}- column "lc_dagster__run_id" {- type = "String"+ column "person_id" {+ type = "UUID"}- column "lc_dagster__owner" {+ column "condition" {type = "String"}- column "lc_modifiers" {+ column "matches" {+ type = "Bool"+ }+ column "source" {type = "String"}- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_query_log_archive"- replica_name = "{replica}"+ column "_timestamp" {+ type = "DateTime64(6)"+ }+ column "_offset" {+ type = "UInt64"+ }+ engine "replicated_replacing_merge_tree" {+ zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_precalculated_person_properties"+ replica_name = "{replica}"+ version_column = "_timestamp"}}@@ -19862,107 +18421,6 @@ SQL}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -24397,140 +22855,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-eu/ai_events.hcl b/posthog/clickhouse/hcl/golden/prod-eu/ai_events.hclindex ae4081561509..923b86a7b30c 100644--- a/posthog/clickhouse/hcl/golden/prod-eu/ai_events.hcl+++ b/posthog/clickhouse/hcl/golden/prod-eu/ai_events.hcl@@ -739,496 +739,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -1839,140 +1349,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-eu/apm.hcl b/posthog/clickhouse/hcl/golden/prod-eu/apm.hclindex e2d37ea7ffbe..197ea16b9716 100644--- a/posthog/clickhouse/hcl/golden/prod-eu/apm.hcl+++ b/posthog/clickhouse/hcl/golden/prod-eu/apm.hcl@@ -367,107 +367,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -1293,140 +1192,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-eu/auxiliary.hcl b/posthog/clickhouse/hcl/golden/prod-eu/auxiliary.hclindex daf9a838c9a9..73454ad49905 100644--- a/posthog/clickhouse/hcl/golden/prod-eu/auxiliary.hcl+++ b/posthog/clickhouse/hcl/golden/prod-eu/auxiliary.hcl@@ -2122,395 +2122,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "raw_error_tracking_fingerprint_issue_state" {order_by = ["team_id", "fingerprint"]settings = {@@ -5240,107 +4851,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -5932,140 +5442,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-eu/batch_exports.hcl b/posthog/clickhouse/hcl/golden/prod-eu/batch_exports.hclindex 232076ed97e7..246e5883da4a 100644--- a/posthog/clickhouse/hcl/golden/prod-eu/batch_exports.hcl+++ b/posthog/clickhouse/hcl/golden/prod-eu/batch_exports.hcl@@ -388,395 +388,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "sharded_events_recent" {order_by = ["team_id", "toStartOfHour(inserted_at)", "event", "cityHash64(distinct_id)", "cityHash64(uuid)"]partition_by = "toStartOfDay(inserted_at)"@@ -878,107 +489,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -1335,140 +845,6 @@ database "posthog" {}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-eu/data.hcl b/posthog/clickhouse/hcl/golden/prod-eu/data.hclindex fcfba7615d83..3d7a22f1c902 100644--- a/posthog/clickhouse/hcl/golden/prod-eu/data.hcl+++ b/posthog/clickhouse/hcl/golden/prod-eu/data.hcl@@ -4359,395 +4359,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "raw_sessions" {column "team_id" {type = "Int64"@@ -8945,107 +8556,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -10136,140 +9646,6 @@ database "posthog" {}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-eu/logs.hcl b/posthog/clickhouse/hcl/golden/prod-eu/logs.hclindex cef67a272fcc..7af8e3e912d7 100644--- a/posthog/clickhouse/hcl/golden/prod-eu/logs.hcl+++ b/posthog/clickhouse/hcl/golden/prod-eu/logs.hcl@@ -2743,395 +2743,6 @@ SQL}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "trace_attributes" {order_by = ["team_id", "attribute_type", "time_bucket", "resource_fingerprint", "attribute_key", "attribute_value"]partition_by = "toDate(original_expiry_time_bucket)"@@ -3679,107 +3290,6 @@ SQL}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -4628,140 +4138,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-eu/ops.hcl b/posthog/clickhouse/hcl/golden/prod-eu/ops.hclindex d7dafd45c655..fcec6d79c2df 100644--- a/posthog/clickhouse/hcl/golden/prod-eu/ops.hcl+++ b/posthog/clickhouse/hcl/golden/prod-eu/ops.hcl@@ -783,114 +783,7 @@ SQL}}- table "query_log_archive_buffer" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "buffer" {- database = "posthog"- table = "sharded_query_log_archive"- num_layers = 16- min_time = 10- max_time = 60- min_rows = 10000- max_rows = 1000000- min_bytes = 10000000- max_bytes = 100000000- }- }-- table "query_log_archive_v3" {+ table "query_log_archive_v3_buffer" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"}@@ -1239,871 +1132,110 @@ SQLcolumn "lc_estimated_bytes" {type = "SimpleAggregateFunction(max, Int64)"}- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"+ engine "buffer" {+ database = "posthog"+ table = "sharded_query_log_archive_v3"+ num_layers = 16+ min_time = 10+ max_time = 60+ min_rows = 10000+ max_rows = 1000000+ min_bytes = 10000000+ max_bytes = 100000000}}- table "query_log_archive_v3_buffer" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"+ table "query_team_daily_stats" {+ order_by = ["analysis_date", "team_id"]+ ttl = "analysis_date + toIntervalDay(90)"+ settings = {+ index_granularity = "8192"+ }+ column "analysis_date" {+ type = "Date"}column "team_id" {type = "Int64"}- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "query_count" {+ type = "UInt64"}- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "error_count" {+ type = "UInt64"}- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "distinct_query_shapes" {+ type = "UInt64"}- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "total_duration_ms" {+ type = "UInt64"}- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "avg_duration_ms" {+ type = "Float64"}- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "p50_duration_ms" {+ type = "Float64"}- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- engine "buffer" {- database = "posthog"- table = "sharded_query_log_archive_v3"- num_layers = 16- min_time = 10- max_time = 60- min_rows = 10000- max_rows = 1000000- min_bytes = 10000000- max_bytes = 100000000- }- }-- table "query_team_daily_stats" {- order_by = ["analysis_date", "team_id"]- ttl = "analysis_date + toIntervalDay(90)"- settings = {- index_granularity = "8192"- }- column "analysis_date" {- type = "Date"- }- column "team_id" {- type = "Int64"- }- column "query_count" {- type = "UInt64"- }- column "error_count" {- type = "UInt64"- }- column "distinct_query_shapes" {- type = "UInt64"- }- column "total_duration_ms" {- type = "UInt64"- }- column "avg_duration_ms" {- type = "Float64"- }- column "p50_duration_ms" {- type = "Float64"- }- column "p90_duration_ms" {- type = "Float64"- }- column "p99_duration_ms" {- type = "Float64"- }- column "max_duration_ms" {- type = "UInt64"- }- column "total_read_rows" {- type = "UInt64"- }- column "total_read_bytes" {- type = "UInt64"- comment = "Uncompressed bytes scanned, coordinator-side summed across shards (is_initial_query=1). Compute/scan cost proxy, NOT stored footprint."- }- column "total_result_rows" {- type = "UInt64"- }- column "total_result_bytes" {- type = "UInt64"- }- column "total_written_rows" {- type = "UInt64"- }- column "total_written_bytes" {- type = "UInt64"- }- column "total_cpu_seconds" {- type = "Float64"- comment = "ProfileEvents OSCPUVirtualTimeMicroseconds summed across ALL QueryFinish rows (initiator + shard leaves) / 1e6. CPU is not folded onto the initiator row, so leaves must be summed."- }- column "total_memory_usage" {- type = "UInt64"- comment = "Peak memory_usage summed across all shard rows (per-node peak; not folded onto the initiator)."- }- column "max_memory_usage" {- type = "UInt64"- comment = "Largest single-node peak memory across all shard rows."- }- column "p99_memory_usage" {- type = "Float64"- }- column "total_s3_get_objects" {- type = "UInt64"- comment = "ProfileEvents S3GetObject summed across all shard rows: object-storage GET count."- }- column "total_s3_read_bytes" {- type = "UInt64"- comment = "ProfileEvents ReadBufferFromS3Bytes summed across all shard rows: object-storage read cost proxy."- }- column "query_kind_counts" {- type = "Map(String, UInt64)"- comment = "query_kind -> count for QueryFinish rows."- }- column "computed_at" {- type = "DateTime"- }- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/ops/tables/{shard}/posthog.query_team_daily_stats"- replica_name = "{replica}"- }- }-- table "sharded_query_log_archive" {- order_by = ["team_id", "event_date", "event_time", "query_id"]- partition_by = "toYYYYMM(event_date)"- settings = {- index_granularity = "8192"- max_replicated_merges_in_queue = "6"- object_serialization_version = "v3"- object_shared_data_serialization_version = "map_with_buckets"- parts_to_delay_insert = "1000"- parts_to_throw_insert = "3000"- prefer_fetch_merged_part_size_threshold = "1"- prefer_fetch_merged_part_time_threshold = "60"- }- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- column "exception_name" {- type = "String"- alias = "errorCodeToName(exception_code)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "Int64"- alias = "ProfileEvents['RealTimeMicroseconds']"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "Int64"- alias = "ProfileEvents['OSCPUVirtualTimeMicroseconds']"- }- column "ProfileEvents_S3Clients" {- type = "Int64"- alias = "ProfileEvents['S3Clients']"- }- column "ProfileEvents_S3DeleteObjects" {- type = "Int64"- alias = "ProfileEvents['S3DeleteObjects']"- }- column "ProfileEvents_S3CopyObject" {- type = "Int64"- alias = "ProfileEvents['S3CopyObject']"- }- column "ProfileEvents_S3ListObjects" {- type = "Int64"- alias = "ProfileEvents['S3ListObjects']"- }- column "ProfileEvents_S3HeadObject" {- type = "Int64"- alias = "ProfileEvents['S3HeadObject']"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "Int64"- alias = "ProfileEvents['S3GetObjectAttributes']"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3CreateMultipartUpload']"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "Int64"- alias = "ProfileEvents['S3UploadPartCopy']"- }- column "ProfileEvents_S3UploadPart" {- type = "Int64"- alias = "ProfileEvents['S3UploadPart']"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3AbortMultipartUpload']"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3CompleteMultipartUpload']"- }- column "ProfileEvents_S3PutObject" {- type = "Int64"- alias = "ProfileEvents['S3PutObject']"- }- column "ProfileEvents_S3GetObject" {- type = "Int64"- alias = "ProfileEvents['S3GetObject']"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "Int64"- alias = "ProfileEvents['ReadBufferFromS3Bytes']"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "Int64"- alias = "ProfileEvents['WriteBufferFromS3Bytes']"- }- column "lc_workflow" {- type = "LowCardinality(String)"- alias = "log_comment.workflow"- }- column "lc_kind" {- type = "LowCardinality(String)"- alias = "log_comment.kind"- }- column "lc_id" {- type = "String"- alias = "CAST(log_comment.id, 'String')"- }- column "lc_route_id" {- type = "String"- alias = "CAST(log_comment.route_id, 'String')"- }- column "lc_access_method" {- type = "LowCardinality(String)"- alias = "log_comment.access_method"- }- column "lc_api_key_label" {- type = "String"- alias = "CAST(log_comment.api_key_label, 'String')"- }- column "lc_api_key_mask" {- type = "String"- alias = "CAST(log_comment.api_key_mask, 'String')"- }- column "lc_query_type" {- type = "LowCardinality(String)"- alias = "log_comment.query_type"- }- column "lc_product" {- type = "LowCardinality(String)"- alias = "log_comment.product"- }- column "lc_chargeable" {- type = "Bool"- alias = "log_comment.chargeable"- }- column "lc_name" {- type = "String"- alias = "CAST(log_comment.name, 'String')"- }- column "lc_request_name" {- type = "String"- alias = "CAST(log_comment.request_name, 'String')"- }- column "lc_client_query_id" {- type = "String"- alias = "CAST(log_comment.client_query_id, 'String')"- }- column "lc_org_id" {- type = "String"- alias = "CAST(log_comment.org_id, 'String')"- }- column "lc_user_id" {- type = "Int64"- alias = "log_comment.user_id"- }- column "lc_is_impersonated" {- type = "Bool"- alias = "log_comment.is_impersonated"- }- column "lc_session_id" {- type = "String"- alias = "CAST(log_comment.session_id, 'String')"- }- column "lc_dashboard_id" {- type = "Int64"- alias = "log_comment.dashboard_id"- }- column "lc_insight_id" {- type = "Int64"- alias = "log_comment.insight_id"- }- column "lc_cohort_id" {- type = "Int64"- alias = "log_comment.cohort_id"- }- column "lc_batch_export_id" {- type = "String"- alias = "CAST(log_comment.batch_export_id, 'String')"- }- column "lc_experiment_id" {- type = "Int64"- alias = "log_comment.experiment_id"- }- column "lc_experiment_feature_flag_key" {- type = "String"- alias = "CAST(log_comment.experiment_feature_flag_key, 'String')"- }- column "lc_alert_config_id" {- type = "String"- alias = "CAST(log_comment.alert_config_id, 'String')"- }- column "lc_feature" {- type = "LowCardinality(String)"- alias = "log_comment.feature"- }- column "lc_table_id" {- type = "String"- alias = "CAST(log_comment.table_id, 'String')"- }- column "lc_warehouse_query" {- type = "Bool"- alias = "log_comment.warehouse_query"- }- column "lc_person_on_events_mode" {- type = "LowCardinality(String)"- alias = "log_comment.person_on_events_mode"- }- column "lc_service_name" {- type = "String"- alias = "CAST(log_comment.service_name, 'String')"- }- column "lc_workload" {- type = "LowCardinality(String)"- alias = "log_comment.workload"- }- column "lc_query__kind" {- type = "LowCardinality(String)"- alias = "if(JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'kind'), JSONExtractString(toString(log_comment), 'query', 'kind'))"+ column "p90_duration_ms" {+ type = "Float64"}- column "lc_query__query" {- type = "String"- alias = "multiIf(NOT is_initial_query, '', JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'), JSONExtractString(toString(log_comment), 'query', 'query'))"+ column "p99_duration_ms" {+ type = "Float64"}- column "lc_query" {- type = "String"- alias = "if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), '')"+ column "max_duration_ms" {+ type = "UInt64"}- column "lc_temporal__workflow_namespace" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_namespace`, 'String')"+ column "total_read_rows" {+ type = "UInt64"}- column "lc_temporal__workflow_type" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_type`, 'String')"+ column "total_read_bytes" {+ type = "UInt64"+ comment = "Uncompressed bytes scanned, coordinator-side summed across shards (is_initial_query=1). Compute/scan cost proxy, NOT stored footprint."}- column "lc_temporal__workflow_id" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_id`, 'String')"+ column "total_result_rows" {+ type = "UInt64"}- column "lc_temporal__workflow_run_id" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_run_id`, 'String')"+ column "total_result_bytes" {+ type = "UInt64"}- column "lc_temporal__activity_type" {- type = "String"- alias = "CAST(log_comment.`temporal.activity_type`, 'String')"+ column "total_written_rows" {+ type = "UInt64"}- column "lc_temporal__activity_id" {- type = "String"- alias = "CAST(log_comment.`temporal.activity_id`, 'String')"+ column "total_written_bytes" {+ type = "UInt64"}- column "lc_temporal__attempt" {- type = "Int64"- alias = "log_comment.`temporal.attempt`"+ column "total_cpu_seconds" {+ type = "Float64"+ comment = "ProfileEvents OSCPUVirtualTimeMicroseconds summed across ALL QueryFinish rows (initiator + shard leaves) / 1e6. CPU is not folded onto the initiator row, so leaves must be summed."}- column "lc_dagster__job_name" {- type = "String"- alias = "CAST(log_comment.`dagster.job_name`, 'String')"+ column "total_memory_usage" {+ type = "UInt64"+ comment = "Peak memory_usage summed across all shard rows (per-node peak; not folded onto the initiator)."}- column "lc_dagster__run_id" {- type = "String"- alias = "CAST(log_comment.`dagster.run_id`, 'String')"+ column "max_memory_usage" {+ type = "UInt64"+ comment = "Largest single-node peak memory across all shard rows."}- column "lc_dagster__owner" {- type = "String"- alias = "CAST(log_comment.`dagster.tags.owner`, 'String')"+ column "p99_memory_usage" {+ type = "Float64"}- column "lc_modifiers" {- type = "String"- alias = "if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), '')"+ column "total_s3_get_objects" {+ type = "UInt64"+ comment = "ProfileEvents S3GetObject summed across all shard rows: object-storage GET count."}- column "lc_plan_fingerprint" {- type = "String"- alias = "ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), '')"+ column "total_s3_read_bytes" {+ type = "UInt64"+ comment = "ProfileEvents ReadBufferFromS3Bytes summed across all shard rows: object-storage read cost proxy."}- column "lc_estimated_rows" {- type = "Int64"- alias = "ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0)"+ column "query_kind_counts" {+ type = "Map(String, UInt64)"+ comment = "query_kind -> count for QueryFinish rows."}- column "lc_estimated_bytes" {- type = "Int64"- alias = "ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0)"+ column "computed_at" {+ type = "DateTime"}engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.sharded_query_log_archive"- replica_name = "{replica}-{shard}"+ zoo_path = "/clickhouse/ops/tables/{shard}/posthog.query_team_daily_stats"+ replica_name = "{replica}"}}@@ -2610,107 +1742,6 @@ SQL}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -3097,140 +2128,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-eu/sessions.hcl b/posthog/clickhouse/hcl/golden/prod-eu/sessions.hclindex a6627e5d2691..2949718c96d4 100644--- a/posthog/clickhouse/hcl/golden/prod-eu/sessions.hcl+++ b/posthog/clickhouse/hcl/golden/prod-eu/sessions.hcl@@ -724,395 +724,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "raw_sessions" {order_by = ["team_id", "toStartOfHour(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(session_id_v7, 80)), 1000)))", "cityHash64(session_id_v7)", "session_id_v7"]partition_by = "toYYYYMM(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(session_id_v7, 80)), 1000)))"@@ -1582,107 +1193,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -2039,140 +1549,6 @@ database "posthog" {}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-us/ai_events.hcl b/posthog/clickhouse/hcl/golden/prod-us/ai_events.hclindex ae4081561509..923b86a7b30c 100644--- a/posthog/clickhouse/hcl/golden/prod-us/ai_events.hcl+++ b/posthog/clickhouse/hcl/golden/prod-us/ai_events.hcl@@ -739,496 +739,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -1839,140 +1349,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-us/apm.hcl b/posthog/clickhouse/hcl/golden/prod-us/apm.hclindex e2d37ea7ffbe..197ea16b9716 100644--- a/posthog/clickhouse/hcl/golden/prod-us/apm.hcl+++ b/posthog/clickhouse/hcl/golden/prod-us/apm.hcl@@ -367,107 +367,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -1293,140 +1192,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-us/auxiliary.hcl b/posthog/clickhouse/hcl/golden/prod-us/auxiliary.hclindex ae6997b3836c..5e1ee7e3bc88 100644--- a/posthog/clickhouse/hcl/golden/prod-us/auxiliary.hcl+++ b/posthog/clickhouse/hcl/golden/prod-us/auxiliary.hcl@@ -2160,395 +2160,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "raw_error_tracking_fingerprint_issue_state" {order_by = ["team_id", "fingerprint"]settings = {@@ -5278,107 +4889,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -5970,140 +5480,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-us/batch_exports.hcl b/posthog/clickhouse/hcl/golden/prod-us/batch_exports.hclindex 6341d310dfe8..562ef65bcc6d 100644--- a/posthog/clickhouse/hcl/golden/prod-us/batch_exports.hcl+++ b/posthog/clickhouse/hcl/golden/prod-us/batch_exports.hcl@@ -388,395 +388,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "sharded_events_recent" {order_by = ["team_id", "toStartOfHour(inserted_at)", "event", "cityHash64(distinct_id)", "cityHash64(uuid)"]partition_by = "toStartOfDay(inserted_at)"@@ -870,107 +481,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -1327,140 +837,6 @@ database "posthog" {}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-us/data.hcl b/posthog/clickhouse/hcl/golden/prod-us/data.hclindex 82ab4645bf90..c9bcb6d30149 100644--- a/posthog/clickhouse/hcl/golden/prod-us/data.hcl+++ b/posthog/clickhouse/hcl/golden/prod-us/data.hcl@@ -4154,395 +4154,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "raw_sessions" {column "team_id" {type = "Int64"@@ -8602,107 +8213,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -10057,140 +9567,6 @@ database "posthog" {}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-us/logs.hcl b/posthog/clickhouse/hcl/golden/prod-us/logs.hclindex 239208242abe..388facf475f3 100644--- a/posthog/clickhouse/hcl/golden/prod-us/logs.hcl+++ b/posthog/clickhouse/hcl/golden/prod-us/logs.hcl@@ -2743,395 +2743,6 @@ SQL}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "trace_attributes" {order_by = ["team_id", "attribute_type", "time_bucket", "resource_fingerprint", "attribute_key", "attribute_value"]partition_by = "toDate(original_expiry_time_bucket)"@@ -3661,107 +3272,6 @@ SQL}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -4610,140 +4120,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-us/ops.hcl b/posthog/clickhouse/hcl/golden/prod-us/ops.hclindex f3cb8eb982b1..6e9f75dfc40c 100644--- a/posthog/clickhouse/hcl/golden/prod-us/ops.hcl+++ b/posthog/clickhouse/hcl/golden/prod-us/ops.hcl@@ -867,114 +867,7 @@ SQL}}- table "query_log_archive_buffer" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "buffer" {- database = "posthog"- table = "sharded_query_log_archive"- num_layers = 16- min_time = 10- max_time = 60- min_rows = 10000- max_rows = 1000000- min_bytes = 10000000- max_bytes = 100000000- }- }-- table "query_log_archive_v3" {+ table "query_log_archive_v3_buffer" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"}@@ -1323,871 +1216,111 @@ SQLcolumn "lc_estimated_bytes" {type = "SimpleAggregateFunction(max, Int64)"}- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"+ engine "buffer" {+ database = "posthog"+ table = "sharded_query_log_archive_v3"+ num_layers = 16+ min_time = 10+ max_time = 60+ min_rows = 10000+ max_rows = 1000000+ min_bytes = 10000000+ max_bytes = 100000000}}- table "query_log_archive_v3_buffer" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"+ table "query_team_daily_stats" {+ order_by = ["analysis_date", "team_id"]+ partition_by = "analysis_date"+ ttl = "analysis_date + toIntervalDay(90)"+ settings = {+ index_granularity = "8192"+ }+ column "analysis_date" {+ type = "Date"}column "team_id" {type = "Int64"}- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "query_count" {+ type = "UInt64"}- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "error_count" {+ type = "UInt64"}- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "distinct_query_shapes" {+ type = "UInt64"}- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "total_duration_ms" {+ type = "UInt64"}- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"+ column "avg_duration_ms" {+ type = "Float64"}- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- engine "buffer" {- database = "posthog"- table = "sharded_query_log_archive_v3"- num_layers = 16- min_time = 10- max_time = 60- min_rows = 10000- max_rows = 1000000- min_bytes = 10000000- max_bytes = 100000000- }- }-- table "query_team_daily_stats" {- order_by = ["analysis_date", "team_id"]- partition_by = "analysis_date"- ttl = "analysis_date + toIntervalDay(90)"- settings = {- index_granularity = "8192"- }- column "analysis_date" {- type = "Date"- }- column "team_id" {- type = "Int64"- }- column "query_count" {- type = "UInt64"- }- column "error_count" {- type = "UInt64"- }- column "distinct_query_shapes" {- type = "UInt64"- }- column "total_duration_ms" {- type = "UInt64"- }- column "avg_duration_ms" {- type = "Float64"- }- column "p50_duration_ms" {- type = "Float64"- }- column "p90_duration_ms" {- type = "Float64"- }- column "p99_duration_ms" {- type = "Float64"- }- column "max_duration_ms" {- type = "UInt64"- }- column "total_read_rows" {- type = "UInt64"- }- column "total_read_bytes" {- type = "UInt64"- comment = "Uncompressed bytes scanned, coordinator-side summed across shards (is_initial_query=1). Compute/scan cost proxy, NOT stored footprint."- }- column "total_result_rows" {- type = "UInt64"- }- column "total_result_bytes" {- type = "UInt64"- }- column "total_written_rows" {- type = "UInt64"- }- column "total_written_bytes" {- type = "UInt64"- }- column "total_cpu_seconds" {- type = "Float64"- comment = "ProfileEvents OSCPUVirtualTimeMicroseconds summed across ALL QueryFinish rows (initiator + shard leaves) / 1e6. CPU is not folded onto the initiator row, so leaves must be summed."- }- column "total_memory_usage" {- type = "UInt64"- comment = "Peak memory_usage summed across all shard rows (per-node peak; not folded onto the initiator)."- }- column "max_memory_usage" {- type = "UInt64"- comment = "Largest single-node peak memory across all shard rows."- }- column "p99_memory_usage" {+ column "p50_duration_ms" {type = "Float64"}- column "total_s3_get_objects" {- type = "UInt64"- comment = "ProfileEvents S3GetObject summed across all shard rows: object-storage GET count."- }- column "total_s3_read_bytes" {- type = "UInt64"- comment = "ProfileEvents ReadBufferFromS3Bytes summed across all shard rows: object-storage read cost proxy."- }- column "query_kind_counts" {- type = "Map(String, UInt64)"- comment = "query_kind -> count for QueryFinish rows."- }- column "computed_at" {- type = "DateTime"- }- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/ops/tables/{shard}/posthog.query_team_daily_stats"- replica_name = "{replica}"- }- }-- table "sharded_query_log_archive" {- order_by = ["team_id", "event_date", "event_time", "query_id"]- partition_by = "toYYYYMM(event_date)"- settings = {- index_granularity = "8192"- object_serialization_version = "v3"- object_shared_data_serialization_version = "map_with_buckets"- storage_policy = "s3_tiered"- }- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- column "exception_name" {- type = "String"- alias = "errorCodeToName(exception_code)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "Int64"- alias = "ProfileEvents['RealTimeMicroseconds']"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "Int64"- alias = "ProfileEvents['OSCPUVirtualTimeMicroseconds']"- }- column "ProfileEvents_S3Clients" {- type = "Int64"- alias = "ProfileEvents['S3Clients']"- }- column "ProfileEvents_S3DeleteObjects" {- type = "Int64"- alias = "ProfileEvents['S3DeleteObjects']"- }- column "ProfileEvents_S3CopyObject" {- type = "Int64"- alias = "ProfileEvents['S3CopyObject']"- }- column "ProfileEvents_S3ListObjects" {- type = "Int64"- alias = "ProfileEvents['S3ListObjects']"- }- column "ProfileEvents_S3HeadObject" {- type = "Int64"- alias = "ProfileEvents['S3HeadObject']"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "Int64"- alias = "ProfileEvents['S3GetObjectAttributes']"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3CreateMultipartUpload']"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "Int64"- alias = "ProfileEvents['S3UploadPartCopy']"- }- column "ProfileEvents_S3UploadPart" {- type = "Int64"- alias = "ProfileEvents['S3UploadPart']"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3AbortMultipartUpload']"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3CompleteMultipartUpload']"- }- column "ProfileEvents_S3PutObject" {- type = "Int64"- alias = "ProfileEvents['S3PutObject']"- }- column "ProfileEvents_S3GetObject" {- type = "Int64"- alias = "ProfileEvents['S3GetObject']"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "Int64"- alias = "ProfileEvents['ReadBufferFromS3Bytes']"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "Int64"- alias = "ProfileEvents['WriteBufferFromS3Bytes']"- }- column "lc_workflow" {- type = "LowCardinality(String)"- alias = "log_comment.workflow"- }- column "lc_kind" {- type = "LowCardinality(String)"- alias = "log_comment.kind"- }- column "lc_id" {- type = "String"- alias = "CAST(log_comment.id, 'String')"- }- column "lc_route_id" {- type = "String"- alias = "CAST(log_comment.route_id, 'String')"- }- column "lc_access_method" {- type = "LowCardinality(String)"- alias = "log_comment.access_method"- }- column "lc_api_key_label" {- type = "String"- alias = "CAST(log_comment.api_key_label, 'String')"- }- column "lc_api_key_mask" {- type = "String"- alias = "CAST(log_comment.api_key_mask, 'String')"- }- column "lc_query_type" {- type = "LowCardinality(String)"- alias = "log_comment.query_type"- }- column "lc_product" {- type = "LowCardinality(String)"- alias = "log_comment.product"- }- column "lc_chargeable" {- type = "Bool"- alias = "log_comment.chargeable"- }- column "lc_name" {- type = "String"- alias = "CAST(log_comment.name, 'String')"- }- column "lc_request_name" {- type = "String"- alias = "CAST(log_comment.request_name, 'String')"- }- column "lc_client_query_id" {- type = "String"- alias = "CAST(log_comment.client_query_id, 'String')"- }- column "lc_org_id" {- type = "String"- alias = "CAST(log_comment.org_id, 'String')"- }- column "lc_user_id" {- type = "Int64"- alias = "log_comment.user_id"- }- column "lc_is_impersonated" {- type = "Bool"- alias = "log_comment.is_impersonated"- }- column "lc_session_id" {- type = "String"- alias = "CAST(log_comment.session_id, 'String')"- }- column "lc_dashboard_id" {- type = "Int64"- alias = "log_comment.dashboard_id"- }- column "lc_insight_id" {- type = "Int64"- alias = "log_comment.insight_id"- }- column "lc_cohort_id" {- type = "Int64"- alias = "log_comment.cohort_id"- }- column "lc_batch_export_id" {- type = "String"- alias = "CAST(log_comment.batch_export_id, 'String')"- }- column "lc_experiment_id" {- type = "Int64"- alias = "log_comment.experiment_id"- }- column "lc_experiment_feature_flag_key" {- type = "String"- alias = "CAST(log_comment.experiment_feature_flag_key, 'String')"- }- column "lc_alert_config_id" {- type = "String"- alias = "CAST(log_comment.alert_config_id, 'String')"- }- column "lc_feature" {- type = "LowCardinality(String)"- alias = "log_comment.feature"- }- column "lc_table_id" {- type = "String"- alias = "CAST(log_comment.table_id, 'String')"- }- column "lc_warehouse_query" {- type = "Bool"- alias = "log_comment.warehouse_query"- }- column "lc_person_on_events_mode" {- type = "LowCardinality(String)"- alias = "log_comment.person_on_events_mode"- }- column "lc_service_name" {- type = "String"- alias = "CAST(log_comment.service_name, 'String')"- }- column "lc_workload" {- type = "LowCardinality(String)"- alias = "log_comment.workload"- }- column "lc_query__kind" {- type = "LowCardinality(String)"- alias = "if(JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'kind'), JSONExtractString(toString(log_comment), 'query', 'kind'))"- }- column "lc_query__query" {- type = "String"- alias = "multiIf(NOT is_initial_query, '', JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'), JSONExtractString(toString(log_comment), 'query', 'query'))"+ column "p90_duration_ms" {+ type = "Float64"}- column "lc_query" {- type = "String"- alias = "if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), '')"+ column "p99_duration_ms" {+ type = "Float64"}- column "lc_temporal__workflow_namespace" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_namespace`, 'String')"+ column "max_duration_ms" {+ type = "UInt64"}- column "lc_temporal__workflow_type" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_type`, 'String')"+ column "total_read_rows" {+ type = "UInt64"}- column "lc_temporal__workflow_id" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_id`, 'String')"+ column "total_read_bytes" {+ type = "UInt64"+ comment = "Uncompressed bytes scanned, coordinator-side summed across shards (is_initial_query=1). Compute/scan cost proxy, NOT stored footprint."}- column "lc_temporal__workflow_run_id" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_run_id`, 'String')"+ column "total_result_rows" {+ type = "UInt64"}- column "lc_temporal__activity_type" {- type = "String"- alias = "CAST(log_comment.`temporal.activity_type`, 'String')"+ column "total_result_bytes" {+ type = "UInt64"}- column "lc_temporal__activity_id" {- type = "String"- alias = "CAST(log_comment.`temporal.activity_id`, 'String')"+ column "total_written_rows" {+ type = "UInt64"}- column "lc_temporal__attempt" {- type = "Int64"- alias = "log_comment.`temporal.attempt`"+ column "total_written_bytes" {+ type = "UInt64"}- column "lc_dagster__job_name" {- type = "String"- alias = "CAST(log_comment.`dagster.job_name`, 'String')"+ column "total_cpu_seconds" {+ type = "Float64"+ comment = "ProfileEvents OSCPUVirtualTimeMicroseconds summed across ALL QueryFinish rows (initiator + shard leaves) / 1e6. CPU is not folded onto the initiator row, so leaves must be summed."}- column "lc_dagster__run_id" {- type = "String"- alias = "CAST(log_comment.`dagster.run_id`, 'String')"+ column "total_memory_usage" {+ type = "UInt64"+ comment = "Peak memory_usage summed across all shard rows (per-node peak; not folded onto the initiator)."}- column "lc_dagster__owner" {- type = "String"- alias = "CAST(log_comment.`dagster.tags.owner`, 'String')"+ column "max_memory_usage" {+ type = "UInt64"+ comment = "Largest single-node peak memory across all shard rows."}- column "lc_modifiers" {- type = "String"- alias = "if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), '')"+ column "p99_memory_usage" {+ type = "Float64"}- column "lc_plan_fingerprint" {- type = "String"- alias = "ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), '')"+ column "total_s3_get_objects" {+ type = "UInt64"+ comment = "ProfileEvents S3GetObject summed across all shard rows: object-storage GET count."}- column "lc_estimated_rows" {- type = "Int64"- alias = "ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0)"+ column "total_s3_read_bytes" {+ type = "UInt64"+ comment = "ProfileEvents ReadBufferFromS3Bytes summed across all shard rows: object-storage read cost proxy."}- column "lc_estimated_bytes" {- type = "Int64"- alias = "ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0)"+ column "query_kind_counts" {+ type = "Map(String, UInt64)"+ comment = "query_kind -> count for QueryFinish rows."}- column "ProfileEvents2" {- type = "JSON(max_dynamic_paths=0, OSCPUVirtualTimeMicroseconds UInt64, ReadBufferFromS3Bytes UInt64, RealTimeMicroseconds UInt64, S3AbortMultipartUpload UInt64, S3Clients UInt64, S3CompleteMultipartUpload UInt64, S3CopyObject UInt64, S3CreateMultipartUpload UInt64, S3DeleteObjects UInt64, S3GetObject UInt64, S3GetObjectAttributes UInt64, S3HeadObject UInt64, S3ListObjects UInt64, S3PutObject UInt64, S3UploadPart UInt64, S3UploadPartCopy UInt64, WriteBufferFromS3Bytes UInt64)"+ column "computed_at" {+ type = "DateTime"}engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.sharded_query_log_archive"- replica_name = "{replica}-{shard}"+ zoo_path = "/clickhouse/ops/tables/{shard}/posthog.query_team_daily_stats"+ replica_name = "{replica}"}}@@ -2694,107 +1827,6 @@ SQL}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -3181,140 +2213,6 @@ SQL}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/golden/prod-us/sessions.hcl b/posthog/clickhouse/hcl/golden/prod-us/sessions.hclindex a3eff22010fd..a9f5131a9e8b 100644--- a/posthog/clickhouse/hcl/golden/prod-us/sessions.hcl+++ b/posthog/clickhouse/hcl/golden/prod-us/sessions.hcl@@ -728,395 +728,6 @@ database "posthog" {}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }-table "raw_sessions" {order_by = ["team_id", "toStartOfHour(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(session_id_v7, 80)), 1000)))", "cityHash64(session_id_v7)", "session_id_v7"]partition_by = "toYYYYMM(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(session_id_v7, 80)), 1000)))"@@ -1684,107 +1295,6 @@ database "posthog" {}}- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }-table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"@@ -2141,140 +1651,6 @@ database "posthog" {}}- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = <<SQL-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'-SQL-- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }-materialized_view "ops_query_log_archive_v3_mv" {to_table = "posthog.writable_query_log_archive_v3"query = <<SQLdiff --git a/posthog/clickhouse/hcl/roles/data/local/tables.hcl b/posthog/clickhouse/hcl/roles/data/local/tables.hclindex b25f1bd66937..3543b2d9d979 100644--- a/posthog/clickhouse/hcl/roles/data/local/tables.hcl+++ b/posthog/clickhouse/hcl/roles/data/local/tables.hcl@@ -699,582 +699,6 @@ database "posthog" {version_column = "inserted_at"}}- table "query_log_archive_v2" {- order_by = ["team_id", "event_date", "event_time", "query_id"]- partition_by = "toYYYYMM(event_date)"- settings = {- index_granularity = "8192"- }- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception_name" {- type = "String"- alias = "errorCodeToName(exception_code)"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "Int64"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "Int64"- }- column "ProfileEvents_S3Clients" {- type = "Int64"- }- column "ProfileEvents_S3DeleteObjects" {- type = "Int64"- }- column "ProfileEvents_S3CopyObject" {- type = "Int64"- }- column "ProfileEvents_S3ListObjects" {- type = "Int64"- }- column "ProfileEvents_S3HeadObject" {- type = "Int64"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "Int64"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "Int64"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "Int64"- }- column "ProfileEvents_S3UploadPart" {- type = "Int64"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "Int64"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "Int64"- }- column "ProfileEvents_S3PutObject" {- type = "Int64"- }- column "ProfileEvents_S3GetObject" {- type = "Int64"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "Int64"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "Int64"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- column "lc_workflow" {- type = "LowCardinality(String)"- }- column "lc_kind" {- type = "LowCardinality(String)"- }- column "lc_id" {- type = "String"- }- column "lc_route_id" {- type = "String"- }- column "lc_access_method" {- type = "LowCardinality(String)"- }- column "lc_api_key_label" {- type = "String"- }- column "lc_api_key_mask" {- type = "String"- }- column "lc_query_type" {- type = "LowCardinality(String)"- }- column "lc_product" {- type = "LowCardinality(String)"- }- column "lc_chargeable" {- type = "Bool"- }- column "lc_name" {- type = "String"- }- column "lc_request_name" {- type = "String"- }- column "lc_client_query_id" {- type = "String"- }- column "lc_org_id" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "lc_user_id" {- type = "Int64"- }- column "lc_is_impersonated" {- type = "Bool"- }- column "lc_session_id" {- type = "String"- }- column "lc_dashboard_id" {- type = "Int64"- }- column "lc_insight_id" {- type = "Int64"- }- column "lc_cohort_id" {- type = "Int64"- }- column "lc_batch_export_id" {- type = "String"- }- column "lc_experiment_id" {- type = "Int64"- }- column "lc_experiment_feature_flag_key" {- type = "String"- }- column "lc_alert_config_id" {- type = "String"- }- column "lc_feature" {- type = "LowCardinality(String)"- }- column "lc_table_id" {- type = "String"- }- column "lc_warehouse_query" {- type = "Bool"- }- column "lc_person_on_events_mode" {- type = "LowCardinality(String)"- }- column "lc_service_name" {- type = "String"- }- column "lc_workload" {- type = "LowCardinality(String)"- }- column "lc_query__kind" {- type = "LowCardinality(String)"- }- column "lc_query__query" {- type = "String"- }- column "lc_query" {- type = "String"- }- column "lc_temporal__workflow_namespace" {- type = "String"- }- column "lc_temporal__workflow_type" {- type = "String"- }- column "lc_temporal__workflow_id" {- type = "String"- }- column "lc_temporal__workflow_run_id" {- type = "String"- }- column "lc_temporal__activity_type" {- type = "String"- }- column "lc_temporal__activity_id" {- type = "String"- }- column "lc_temporal__attempt" {- type = "Int64"- }- column "lc_dagster__job_name" {- type = "String"- }- column "lc_dagster__run_id" {- type = "String"- }- column "lc_dagster__owner" {- type = "String"- }- column "lc_modifiers" {- type = "String"- }- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.query_log_archive_new"- replica_name = "{replica}-{shard}"- }- }- table "sharded_query_log_archive_old" {- order_by = ["team_id", "event_date", "event_time", "query_id"]- partition_by = "toYYYYMM(event_date)"- settings = {- index_granularity = "8192"- }- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception_name" {- type = "String"- alias = "errorCodeToName(exception_code)"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "Int64"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "Int64"- }- column "ProfileEvents_S3Clients" {- type = "Int64"- }- column "ProfileEvents_S3DeleteObjects" {- type = "Int64"- }- column "ProfileEvents_S3CopyObject" {- type = "Int64"- }- column "ProfileEvents_S3ListObjects" {- type = "Int64"- }- column "ProfileEvents_S3HeadObject" {- type = "Int64"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "Int64"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "Int64"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "Int64"- }- column "ProfileEvents_S3UploadPart" {- type = "Int64"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "Int64"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "Int64"- }- column "ProfileEvents_S3PutObject" {- type = "Int64"- }- column "ProfileEvents_S3GetObject" {- type = "Int64"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "Int64"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "Int64"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- column "lc_workflow" {- type = "LowCardinality(String)"- }- column "lc_kind" {- type = "LowCardinality(String)"- }- column "lc_id" {- type = "String"- }- column "lc_route_id" {- type = "String"- }- column "lc_access_method" {- type = "LowCardinality(String)"- }- column "lc_api_key_label" {- type = "String"- }- column "lc_api_key_mask" {- type = "String"- }- column "lc_query_type" {- type = "LowCardinality(String)"- }- column "lc_product" {- type = "LowCardinality(String)"- }- column "lc_chargeable" {- type = "Bool"- }- column "lc_name" {- type = "String"- }- column "lc_request_name" {- type = "String"- }- column "lc_client_query_id" {- type = "String"- }- column "lc_org_id" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "lc_user_id" {- type = "Int64"- }- column "lc_is_impersonated" {- type = "Bool"- }- column "lc_session_id" {- type = "String"- }- column "lc_dashboard_id" {- type = "Int64"- }- column "lc_insight_id" {- type = "Int64"- }- column "lc_cohort_id" {- type = "Int64"- }- column "lc_batch_export_id" {- type = "String"- }- column "lc_experiment_id" {- type = "Int64"- }- column "lc_experiment_feature_flag_key" {- type = "String"- }- column "lc_alert_config_id" {- type = "String"- }- column "lc_feature" {- type = "LowCardinality(String)"- }- column "lc_table_id" {- type = "String"- }- column "lc_warehouse_query" {- type = "Bool"- }- column "lc_person_on_events_mode" {- type = "LowCardinality(String)"- }- column "lc_service_name" {- type = "String"- }- column "lc_workload" {- type = "LowCardinality(String)"- }- column "lc_query__kind" {- type = "LowCardinality(String)"- }- column "lc_query__query" {- type = "String"- }- column "lc_query" {- type = "String"- }- column "lc_temporal__workflow_namespace" {- type = "String"- }- column "lc_temporal__workflow_type" {- type = "String"- }- column "lc_temporal__workflow_id" {- type = "String"- }- column "lc_temporal__workflow_run_id" {- type = "String"- }- column "lc_temporal__activity_type" {- type = "String"- }- column "lc_temporal__activity_id" {- type = "String"- }- column "lc_temporal__attempt" {- type = "Int64"- }- column "lc_dagster__job_name" {- type = "String"- }- column "lc_dagster__run_id" {- type = "String"- }- column "lc_dagster__owner" {- type = "String"- }- column "lc_modifiers" {- type = "String"- }- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/{shard}/posthog.sharded_query_log_archive"- replica_name = "{replica}"- }- }materialized_view "events_json_mv" {to_table = "posthog.writable_events"query = file("sql/events_json_mv.sql")diff --git a/posthog/clickhouse/hcl/roles/ops/dev/patches.hcl b/posthog/clickhouse/hcl/roles/ops/dev/patches.hclindex 9da6f996b0b6..221a871c2e42 100644--- a/posthog/clickhouse/hcl/roles/ops/dev/patches.hcl+++ b/posthog/clickhouse/hcl/roles/ops/dev/patches.hcl@@ -1,15 +1,6 @@# dev deltas to base objects. dev tracks prod-us on all three: it is where the# prod-us experiments are tried first.database "posthog" {- patch_table "sharded_query_log_archive" {- column "ProfileEvents2" {- type = "JSON(max_dynamic_paths=0, OSCPUVirtualTimeMicroseconds UInt64, ReadBufferFromS3Bytes UInt64, RealTimeMicroseconds UInt64, S3AbortMultipartUpload UInt64, S3Clients UInt64, S3CompleteMultipartUpload UInt64, S3CopyObject UInt64, S3CreateMultipartUpload UInt64, S3DeleteObjects UInt64, S3GetObject UInt64, S3GetObjectAttributes UInt64, S3HeadObject UInt64, S3ListObjects UInt64, S3PutObject UInt64, S3UploadPart UInt64, S3UploadPartCopy UInt64, WriteBufferFromS3Bytes UInt64)"- }- settings = {- storage_policy = "s3_tiered"- }- }-patch_table "sharded_tophog" {engine "replicated_merge_tree" {zoo_path = "/clickhouse/tables/ops/{shard}/posthog.tophog_new"diff --git a/posthog/clickhouse/hcl/roles/ops/prod-eu/patches.hcl b/posthog/clickhouse/hcl/roles/ops/prod-eu/patches.hclindex 14475b3b75b0..79aaeed1c6f9 100644--- a/posthog/clickhouse/hcl/roles/ops/prod-eu/patches.hcl+++ b/posthog/clickhouse/hcl/roles/ops/prod-eu/patches.hcl@@ -1,17 +1,5 @@# prod-eu deltas to base objects.database "posthog" {- # No tiered storage here, unlike dev and prod-us; the archive is kept in check- # with merge and insert throttling instead.- patch_table "sharded_query_log_archive" {- settings = {- max_replicated_merges_in_queue = "6"- parts_to_delay_insert = "1000"- parts_to_throw_insert = "3000"- prefer_fetch_merged_part_size_threshold = "1"- prefer_fetch_merged_part_time_threshold = "60"- }- }-patch_table "sharded_tophog" {engine "replicated_merge_tree" {zoo_path = "/clickhouse/tables/ops/{shard}/posthog.tophog"diff --git a/posthog/clickhouse/hcl/roles/ops/prod-us/ops.hcl b/posthog/clickhouse/hcl/roles/ops/prod-us/ops.hcldeleted file mode 100644index b75bb8d87f79..000000000000--- a/posthog/clickhouse/hcl/roles/ops/prod-us/ops.hcl+++ /dev/null@@ -1,18 +0,0 @@-# OPS prod-us env layer — events distributed proxies, sharded_tophog (tophog_new zoo_path)-#-# Generated/maintained as the declarative source of truth for the OPS ClickHouse cluster.-# Resolve with: hclexp load -layer <base>,<...>--database "posthog" {- # An extra ProfileEvents2 JSON column on the base sharded_query_log_archive- # table, running on dev and prod-us. Additive patch so the shared base stays- # region-agnostic; fold it in once it reaches prod-eu, drop it if it ends.- patch_table "sharded_query_log_archive" {- column "ProfileEvents2" {- type = "JSON(max_dynamic_paths=0, OSCPUVirtualTimeMicroseconds UInt64, ReadBufferFromS3Bytes UInt64, RealTimeMicroseconds UInt64, S3AbortMultipartUpload UInt64, S3Clients UInt64, S3CompleteMultipartUpload UInt64, S3CopyObject UInt64, S3CreateMultipartUpload UInt64, S3DeleteObjects UInt64, S3GetObject UInt64, S3GetObjectAttributes UInt64, S3HeadObject UInt64, S3ListObjects UInt64, S3PutObject UInt64, S3UploadPart UInt64, S3UploadPartCopy UInt64, WriteBufferFromS3Bytes UInt64)"- }- settings = {- storage_policy = "s3_tiered"- }- }-}diff --git a/posthog/clickhouse/hcl/roles/ops/shared/core.hcl b/posthog/clickhouse/hcl/roles/ops/shared/core.hclindex d80cc1c59f45..de09235c8726 100644--- a/posthog/clickhouse/hcl/roles/ops/shared/core.hcl+++ b/posthog/clickhouse/hcl/roles/ops/shared/core.hcl@@ -53,478 +53,6 @@ database "posthog" {replica_name = "{replica}"}}- table "query_log_archive_buffer" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "buffer" {- database = "posthog"- table = "sharded_query_log_archive"- num_layers = 16- min_time = 10- max_time = 60- min_rows = 10000- max_rows = 1000000- min_bytes = 10000000- max_bytes = 100000000- }- }- table "sharded_query_log_archive" {- order_by = ["team_id", "event_date", "event_time", "query_id"]- partition_by = "toYYYYMM(event_date)"- settings = {- index_granularity = "8192"- object_serialization_version = "v3"- object_shared_data_serialization_version = "map_with_buckets"- }- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- column "exception_name" {- type = "String"- alias = "errorCodeToName(exception_code)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "Int64"- alias = "ProfileEvents['RealTimeMicroseconds']"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "Int64"- alias = "ProfileEvents['OSCPUVirtualTimeMicroseconds']"- }- column "ProfileEvents_S3Clients" {- type = "Int64"- alias = "ProfileEvents['S3Clients']"- }- column "ProfileEvents_S3DeleteObjects" {- type = "Int64"- alias = "ProfileEvents['S3DeleteObjects']"- }- column "ProfileEvents_S3CopyObject" {- type = "Int64"- alias = "ProfileEvents['S3CopyObject']"- }- column "ProfileEvents_S3ListObjects" {- type = "Int64"- alias = "ProfileEvents['S3ListObjects']"- }- column "ProfileEvents_S3HeadObject" {- type = "Int64"- alias = "ProfileEvents['S3HeadObject']"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "Int64"- alias = "ProfileEvents['S3GetObjectAttributes']"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3CreateMultipartUpload']"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "Int64"- alias = "ProfileEvents['S3UploadPartCopy']"- }- column "ProfileEvents_S3UploadPart" {- type = "Int64"- alias = "ProfileEvents['S3UploadPart']"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3AbortMultipartUpload']"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "Int64"- alias = "ProfileEvents['S3CompleteMultipartUpload']"- }- column "ProfileEvents_S3PutObject" {- type = "Int64"- alias = "ProfileEvents['S3PutObject']"- }- column "ProfileEvents_S3GetObject" {- type = "Int64"- alias = "ProfileEvents['S3GetObject']"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "Int64"- alias = "ProfileEvents['ReadBufferFromS3Bytes']"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "Int64"- alias = "ProfileEvents['WriteBufferFromS3Bytes']"- }- column "lc_workflow" {- type = "LowCardinality(String)"- alias = "log_comment.workflow"- }- column "lc_kind" {- type = "LowCardinality(String)"- alias = "log_comment.kind"- }- column "lc_id" {- type = "String"- alias = "CAST(log_comment.id, 'String')"- }- column "lc_route_id" {- type = "String"- alias = "CAST(log_comment.route_id, 'String')"- }- column "lc_access_method" {- type = "LowCardinality(String)"- alias = "log_comment.access_method"- }- column "lc_api_key_label" {- type = "String"- alias = "CAST(log_comment.api_key_label, 'String')"- }- column "lc_api_key_mask" {- type = "String"- alias = "CAST(log_comment.api_key_mask, 'String')"- }- column "lc_query_type" {- type = "LowCardinality(String)"- alias = "log_comment.query_type"- }- column "lc_product" {- type = "LowCardinality(String)"- alias = "log_comment.product"- }- column "lc_chargeable" {- type = "Bool"- alias = "log_comment.chargeable"- }- column "lc_name" {- type = "String"- alias = "CAST(log_comment.name, 'String')"- }- column "lc_request_name" {- type = "String"- alias = "CAST(log_comment.request_name, 'String')"- }- column "lc_client_query_id" {- type = "String"- alias = "CAST(log_comment.client_query_id, 'String')"- }- column "lc_org_id" {- type = "String"- alias = "CAST(log_comment.org_id, 'String')"- }- column "lc_user_id" {- type = "Int64"- alias = "log_comment.user_id"- }- column "lc_is_impersonated" {- type = "Bool"- alias = "log_comment.is_impersonated"- }- column "lc_session_id" {- type = "String"- alias = "CAST(log_comment.session_id, 'String')"- }- column "lc_dashboard_id" {- type = "Int64"- alias = "log_comment.dashboard_id"- }- column "lc_insight_id" {- type = "Int64"- alias = "log_comment.insight_id"- }- column "lc_cohort_id" {- type = "Int64"- alias = "log_comment.cohort_id"- }- column "lc_batch_export_id" {- type = "String"- alias = "CAST(log_comment.batch_export_id, 'String')"- }- column "lc_experiment_id" {- type = "Int64"- alias = "log_comment.experiment_id"- }- column "lc_experiment_feature_flag_key" {- type = "String"- alias = "CAST(log_comment.experiment_feature_flag_key, 'String')"- }- column "lc_alert_config_id" {- type = "String"- alias = "CAST(log_comment.alert_config_id, 'String')"- }- column "lc_feature" {- type = "LowCardinality(String)"- alias = "log_comment.feature"- }- column "lc_table_id" {- type = "String"- alias = "CAST(log_comment.table_id, 'String')"- }- column "lc_warehouse_query" {- type = "Bool"- alias = "log_comment.warehouse_query"- }- column "lc_person_on_events_mode" {- type = "LowCardinality(String)"- alias = "log_comment.person_on_events_mode"- }- column "lc_service_name" {- type = "String"- alias = "CAST(log_comment.service_name, 'String')"- }- column "lc_workload" {- type = "LowCardinality(String)"- alias = "log_comment.workload"- }- column "lc_query__kind" {- type = "LowCardinality(String)"- alias = "if(JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'kind'), JSONExtractString(toString(log_comment), 'query', 'kind'))"- }- column "lc_query__query" {- type = "String"- alias = "multiIf(NOT is_initial_query, '', JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'), JSONExtractString(toString(log_comment), 'query', 'query'))"- }- column "lc_query" {- type = "String"- alias = "if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), '')"- }- column "lc_temporal__workflow_namespace" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_namespace`, 'String')"- }- column "lc_temporal__workflow_type" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_type`, 'String')"- }- column "lc_temporal__workflow_id" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_id`, 'String')"- }- column "lc_temporal__workflow_run_id" {- type = "String"- alias = "CAST(log_comment.`temporal.workflow_run_id`, 'String')"- }- column "lc_temporal__activity_type" {- type = "String"- alias = "CAST(log_comment.`temporal.activity_type`, 'String')"- }- column "lc_temporal__activity_id" {- type = "String"- alias = "CAST(log_comment.`temporal.activity_id`, 'String')"- }- column "lc_temporal__attempt" {- type = "Int64"- alias = "log_comment.`temporal.attempt`"- }- column "lc_dagster__job_name" {- type = "String"- alias = "CAST(log_comment.`dagster.job_name`, 'String')"- }- column "lc_dagster__run_id" {- type = "String"- alias = "CAST(log_comment.`dagster.run_id`, 'String')"- }- column "lc_dagster__owner" {- type = "String"- alias = "CAST(log_comment.`dagster.tags.owner`, 'String')"- }- column "lc_modifiers" {- type = "String"- alias = "if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), '')"- }- column "lc_plan_fingerprint" {- type = "String"- alias = "ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), '')"- }- column "lc_estimated_rows" {- type = "Int64"- alias = "ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0)"- }- column "lc_estimated_bytes" {- type = "Int64"- alias = "ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0)"- }- engine "replicated_merge_tree" {- zoo_path = "/clickhouse/tables/noshard/posthog.sharded_query_log_archive"- replica_name = "{replica}-{shard}"- }- }table "query_log_archive_v3_buffer" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"diff --git a/posthog/clickhouse/hcl/roles/shared/qla.hcl b/posthog/clickhouse/hcl/roles/shared/qla.hclindex 16b6741a7e44..30822df325d9 100644--- a/posthog/clickhouse/hcl/roles/shared/qla.hcl+++ b/posthog/clickhouse/hcl/roles/shared/qla.hcl@@ -389,392 +389,4 @@ database "posthog" {remote_table = "sharded_query_log_archive_v3"}}- table "query_log_archive_v3" {- column "initial_query_start_time" {- type = "DateTime64(6, 'UTC')"- }- column "team_id" {- type = "Int64"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "SimpleAggregateFunction(max, UInt8)"- }- column "hostname" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "user" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "type" {- type = "SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4))"- }- column "event_time_microseconds" {- type = "SimpleAggregateFunction(max, DateTime64(6, 'UTC'))"- }- column "query_duration_ms" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "read_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "read_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "written_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_rows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "result_bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "memory_usage" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "memory_usage_sum" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "peak_threads_usage" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "execution_count" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "current_database" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "query" {- type = "SimpleAggregateFunction(max, String)"- }- column "normalized_query_hash" {- type = "SimpleAggregateFunction(max, UInt64)"- }- column "query_kind_by_root" {- type = "SimpleAggregateFunction(max, Tuple(UInt8, String))"- }- column "tables" {- type = "SimpleAggregateFunction(max, Array(String))"- }- column "exception_code" {- type = "SimpleAggregateFunction(max, Int32)"- }- column "exception" {- type = "SimpleAggregateFunction(max, String)"- }- column "stack_trace" {- type = "SimpleAggregateFunction(max, String)"- }- column "ProfileEvents_SelectedRows" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_RealTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_OSCPUVirtualTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_UserTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SystemTimeMicroseconds" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedParts" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_SelectedMarks" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkReceiveBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_NetworkSendBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromFileDescriptorReadBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromFileDescriptorWriteBytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3Clients" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3DeleteObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CopyObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3ListObjects" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3HeadObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObjectAttributes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CreateMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPartCopy" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3UploadPart" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3AbortMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3CompleteMultipartUpload" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3PutObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_S3GetObject" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_ReadBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "ProfileEvents_WriteBufferFromS3Bytes" {- type = "SimpleAggregateFunction(sum, UInt64)"- }- column "lc_org_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_user_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_session_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_is_impersonated" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_workflow" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_route_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_access_method" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_api_key_label" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_api_key_mask" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_product" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_chargeable" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_request_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_client_query_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dashboard_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_insight_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_cohort_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_batch_export_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_id" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_experiment_feature_flag_key" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_alert_config_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_feature" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_table_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_warehouse_query" {- type = "SimpleAggregateFunction(max, Bool)"- }- column "lc_person_on_events_mode" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_service_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_workload" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__kind" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_query__query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_query" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_modifiers" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_namespace" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__workflow_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__workflow_run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__activity_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_temporal__activity_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_temporal__attempt" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_dagster__job_name" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_dagster__run_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_dagster__owner" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_metric_name" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_execution_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_funnel_order_type" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_exposures_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_metric_events_path" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_query_surface" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_precompute_table" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_query_group_id" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_precompute_skip_reason" {- type = "SimpleAggregateFunction(max, LowCardinality(String))"- }- column "lc_experiment_scan_date_from" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_experiment_scan_date_to" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_start" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_precompute_window_end" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_plan_fingerprint" {- type = "SimpleAggregateFunction(max, String)"- }- column "lc_estimated_rows" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "lc_estimated_bytes" {- type = "SimpleAggregateFunction(max, Int64)"- }- column "query_id" {- type = "String"- }- column "event_time" {- type = "DateTime('UTC')"- }- column "event_date" {- type = "Date"- }- column "query_start_time" {- type = "DateTime('UTC')"- }- column "query_start_time_microseconds" {- type = "DateTime64(6, 'UTC')"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "formatted_query" {- type = "String"- }- column "query_shape" {- type = "String"- }- column "hogql_shape" {- type = "String"- }- column "exception_name" {- type = "String"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "sharded_query_log_archive_v3"- }- }}diff --git a/posthog/clickhouse/hcl/roles/shared/qla_write.hcl b/posthog/clickhouse/hcl/roles/shared/qla_write.hclindex 9e113014e0da..f6aec68ff342 100644--- a/posthog/clickhouse/hcl/roles/shared/qla_write.hcl+++ b/posthog/clickhouse/hcl/roles/shared/qla_write.hcl@@ -2,203 +2,6 @@# archiving MV. Split from qla.hcl because the local logs node runs only the# query_log_archive table itself (it composes qla.hcl as a single-file layer).database "posthog" {- table "writable_query_log_archive" {- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email)"- }- column "ProfileEvents" {- type = "Map(String, UInt64)"- }- engine "distributed" {- cluster_name = "ops"- remote_database = "posthog"- remote_table = "query_log_archive_buffer"- }- }- materialized_view "ops_query_log_archive_mv" {- to_table = "posthog.writable_query_log_archive"- query = file("sql/ops_query_log_archive_mv.sql")- column "hostname" {- type = "LowCardinality(String)"- }- column "user" {- type = "LowCardinality(String)"- }- column "query_id" {- type = "String"- }- column "initial_query_id" {- type = "String"- }- column "is_initial_query" {- type = "UInt8"- }- column "type" {- type = "Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)"- }- column "event_date" {- type = "Date"- }- column "event_time" {- type = "DateTime"- }- column "event_time_microseconds" {- type = "DateTime64(6)"- }- column "query_start_time" {- type = "DateTime"- }- column "query_start_time_microseconds" {- type = "DateTime64(6)"- }- column "query_duration_ms" {- type = "UInt64"- }- column "read_rows" {- type = "UInt64"- }- column "read_bytes" {- type = "UInt64"- }- column "written_rows" {- type = "UInt64"- }- column "written_bytes" {- type = "UInt64"- }- column "result_rows" {- type = "UInt64"- }- column "result_bytes" {- type = "UInt64"- }- column "memory_usage" {- type = "UInt64"- }- column "peak_threads_usage" {- type = "UInt64"- }- column "current_database" {- type = "LowCardinality(String)"- }- column "query" {- type = "String"- }- column "formatted_query" {- type = "String"- }- column "normalized_query_hash" {- type = "UInt64"- }- column "query_kind" {- type = "LowCardinality(String)"- }- column "exception_code" {- type = "Int32"- }- column "exception" {- type = "String"- }- column "stack_trace" {- type = "String"- }- column "team_id" {- type = "Int64"- }- column "log_comment" {- type = "String"- }- column "ProfileEvents" {- type = "Map(LowCardinality(String), UInt64)"- }- }table "writable_query_log_archive_v3" {column "initial_query_start_time" {type = "DateTime64(6, 'UTC')"diff --git a/posthog/clickhouse/hcl/roles/shared/sql/ops_query_log_archive_mv.sql b/posthog/clickhouse/hcl/roles/shared/sql/ops_query_log_archive_mv.sqldeleted file mode 100644index 523c3d6af605..000000000000--- a/posthog/clickhouse/hcl/roles/shared/sql/ops_query_log_archive_mv.sql+++ /dev/null@@ -1,34 +0,0 @@-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart'diff --git a/posthog/clickhouse/hcl/sql/dev/ai_events.sql b/posthog/clickhouse/hcl/sql/dev/ai_events.sqlindex 079b5e234cbd..fd7a2ca20e0f 100644--- a/posthog/clickhouse/hcl/sql/dev/ai_events.sql+++ b/posthog/clickhouse/hcl/sql/dev/ai_events.sql@@ -233,168 +233,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -586,40 +424,6 @@ CREATE MATERIALIZED VIEW posthog.ai_events_json_ws_mv TO posthog.ai_events (uuid_offset,_partitionFROM posthog.kafka_ai_events_json_ws AS src;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/dev/apm.sql b/posthog/clickhouse/hcl/sql/dev/apm.sqlindex 8ba766fd2b50..6bb81959a5ca 100644--- a/posthog/clickhouse/hcl/sql/dev/apm.sql+++ b/posthog/clickhouse/hcl/sql/dev/apm.sql@@ -257,39 +257,6 @@ CREATE TABLE posthog.writable_metrics_kafka_metrics (max_created_at SimpleAggregateFunction(max, DateTime64(9)),max_lag SimpleAggregateFunction(max, UInt64)) ENGINE = Distributed('logs', 'posthog', 'metrics_kafka_metrics');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -681,40 +648,6 @@ CREATE MATERIALIZED VIEW posthog.metrics4_input_to_metrics4_series TO posthog.wroriginal_expiry_timestampFROM posthog.metrics4_inputWHERE has_labels;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/dev/auxiliary.sql b/posthog/clickhouse/hcl/sql/dev/auxiliary.sqlindex 067602b89e61..17bd75512892 100644--- a/posthog/clickhouse/hcl/sql/dev/auxiliary.sql+++ b/posthog/clickhouse/hcl/sql/dev/auxiliary.sql@@ -455,135 +455,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.raw_error_tracking_fingerprint_issue_state (team_id Int64,fingerprint String,@@ -1324,39 +1195,6 @@ CREATE TABLE posthog.writable_error_tracking_fingerprint_issue_state (_offset UInt64,_partition UInt64) ENGINE = Distributed('aux', 'posthog', 'raw_error_tracking_fingerprint_issue_state');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -1536,40 +1374,6 @@ CREATE MATERIALIZED VIEW posthog.message_assets_mv TO posthog.message_assets_dat_offset,_partitionFROM posthog.kafka_message_assets;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/dev/batch_exports.sql b/posthog/clickhouse/hcl/sql/dev/batch_exports.sqlindex ee521129df32..c797df9c8dc3 100644--- a/posthog/clickhouse/hcl/sql/dev/batch_exports.sql+++ b/posthog/clickhouse/hcl/sql/dev/batch_exports.sql@@ -130,135 +130,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.sharded_events_recent (uuid UUID,event String,@@ -286,39 +157,6 @@ CREATE TABLE posthog.sharded_events_recent (_offset UInt64,inserted_at DateTime64(6, 'UTC') DEFAULT now64()) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/batch_exports/{shard}/posthog.sharded_events_recent', '{replica}', _timestamp) ORDER BY (team_id, toStartOfHour(inserted_at), event, cityHash64(distinct_id), cityHash64(uuid)) PARTITION BY toStartOfDay(inserted_at) TTL toDate(inserted_at) + toIntervalDay(9) SETTINGS index_granularity = 8192, parts_to_delay_insert = 800, parts_to_throw_insert = 1500, ttl_only_drop_parts = 1;-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -437,40 +275,6 @@ CREATE TABLE posthog.writable_query_log_archive_v3 (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_v3_buffer');-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/dev/data.sql b/posthog/clickhouse/hcl/sql/dev/data.sqlindex 5beb841c7879..7d4c4ccf701d 100644--- a/posthog/clickhouse/hcl/sql/dev/data.sql+++ b/posthog/clickhouse/hcl/sql/dev/data.sql@@ -827,135 +827,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.session_replay_features (session_id String,team_id Int64,@@ -2097,39 +1968,6 @@ CREATE TABLE posthog.writable_posthog_document_embeddings_text_embedding_3_small_offset UInt64,_partition UInt64) ENGINE = Distributed('posthog', 'posthog', 'sharded_posthog_document_embeddings_text_embedding_3_small_1536', cityHash64(document_id));-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -2486,40 +2324,6 @@ CREATE TABLE posthog.writeable_performance_events (_offset UInt64,_partition UInt64) ENGINE = Distributed('posthog', 'posthog', 'sharded_performance_events', sipHash64(session_id));-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/dev/logs.sql b/posthog/clickhouse/hcl/sql/dev/logs.sqlindex 1a037b5a0460..4ccafbec9b02 100644--- a/posthog/clickhouse/hcl/sql/dev/logs.sql+++ b/posthog/clickhouse/hcl/sql/dev/logs.sql@@ -707,135 +707,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.trace_attributes (team_id Int32,original_expiry_time_bucket DateTime64(0),@@ -982,39 +853,6 @@ CREATE TABLE posthog.trace_spans_kafka_metrics (max_created_at SimpleAggregateFunction(max, DateTime64(9)),max_lag SimpleAggregateFunction(max, UInt64)) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.trace_spans_kafka_metrics', '{replica}-{shard}') ORDER BY (_topic, _partition) SETTINGS index_granularity = 8192;-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -1316,40 +1154,6 @@ FROM)GROUP BYteam_id, time_bucket, service_name, namespace, environment, severity_text;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/dev/ops.sql b/posthog/clickhouse/hcl/sql/dev/ops.sqlindex fd0fa339b64d..721f3631329d 100644--- a/posthog/clickhouse/hcl/sql/dev/ops.sql+++ b/posthog/clickhouse/hcl/sql/dev/ops.sql@@ -106,105 +106,6 @@ CREATE TABLE posthog.prom_metrics_tags (min_time SimpleAggregateFunction(min, Nullable(DateTime64(3))),max_time SimpleAggregateFunction(max, Nullable(DateTime64(3)))) ENGINE = ReplicatedAggregatingMergeTree('/clickhouse/ops/tables/{shard}/posthog.prom_metrics/tags', '{replica}') PRIMARY KEY (metric_name) ORDER BY (metric_name, id) SETTINGS index_granularity = 8192;-CREATE TABLE posthog.sharded_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64),- exception_name String ALIAS errorCodeToName(exception_code),- ProfileEvents_RealTimeMicroseconds Int64 ALIAS ProfileEvents['RealTimeMicroseconds'],- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64 ALIAS ProfileEvents['OSCPUVirtualTimeMicroseconds'],- ProfileEvents_S3Clients Int64 ALIAS ProfileEvents['S3Clients'],- ProfileEvents_S3DeleteObjects Int64 ALIAS ProfileEvents['S3DeleteObjects'],- ProfileEvents_S3CopyObject Int64 ALIAS ProfileEvents['S3CopyObject'],- ProfileEvents_S3ListObjects Int64 ALIAS ProfileEvents['S3ListObjects'],- ProfileEvents_S3HeadObject Int64 ALIAS ProfileEvents['S3HeadObject'],- ProfileEvents_S3GetObjectAttributes Int64 ALIAS ProfileEvents['S3GetObjectAttributes'],- ProfileEvents_S3CreateMultipartUpload Int64 ALIAS ProfileEvents['S3CreateMultipartUpload'],- ProfileEvents_S3UploadPartCopy Int64 ALIAS ProfileEvents['S3UploadPartCopy'],- ProfileEvents_S3UploadPart Int64 ALIAS ProfileEvents['S3UploadPart'],- ProfileEvents_S3AbortMultipartUpload Int64 ALIAS ProfileEvents['S3AbortMultipartUpload'],- ProfileEvents_S3CompleteMultipartUpload Int64 ALIAS ProfileEvents['S3CompleteMultipartUpload'],- ProfileEvents_S3PutObject Int64 ALIAS ProfileEvents['S3PutObject'],- ProfileEvents_S3GetObject Int64 ALIAS ProfileEvents['S3GetObject'],- ProfileEvents_ReadBufferFromS3Bytes Int64 ALIAS ProfileEvents['ReadBufferFromS3Bytes'],- ProfileEvents_WriteBufferFromS3Bytes Int64 ALIAS ProfileEvents['WriteBufferFromS3Bytes'],- lc_workflow LowCardinality(String) ALIAS log_comment.workflow,- lc_kind LowCardinality(String) ALIAS log_comment.kind,- lc_id String ALIAS CAST(log_comment.id, 'String'),- lc_route_id String ALIAS CAST(log_comment.route_id, 'String'),- lc_access_method LowCardinality(String) ALIAS log_comment.access_method,- lc_api_key_label String ALIAS CAST(log_comment.api_key_label, 'String'),- lc_api_key_mask String ALIAS CAST(log_comment.api_key_mask, 'String'),- lc_query_type LowCardinality(String) ALIAS log_comment.query_type,- lc_product LowCardinality(String) ALIAS log_comment.product,- lc_chargeable Bool ALIAS log_comment.chargeable,- lc_name String ALIAS CAST(log_comment.name, 'String'),- lc_request_name String ALIAS CAST(log_comment.request_name, 'String'),- lc_client_query_id String ALIAS CAST(log_comment.client_query_id, 'String'),- lc_org_id String ALIAS CAST(log_comment.org_id, 'String'),- lc_user_id Int64 ALIAS log_comment.user_id,- lc_is_impersonated Bool ALIAS log_comment.is_impersonated,- lc_session_id String ALIAS CAST(log_comment.session_id, 'String'),- lc_dashboard_id Int64 ALIAS log_comment.dashboard_id,- lc_insight_id Int64 ALIAS log_comment.insight_id,- lc_cohort_id Int64 ALIAS log_comment.cohort_id,- lc_batch_export_id String ALIAS CAST(log_comment.batch_export_id, 'String'),- lc_experiment_id Int64 ALIAS log_comment.experiment_id,- lc_experiment_feature_flag_key String ALIAS CAST(log_comment.experiment_feature_flag_key, 'String'),- lc_alert_config_id String ALIAS CAST(log_comment.alert_config_id, 'String'),- lc_feature LowCardinality(String) ALIAS log_comment.feature,- lc_table_id String ALIAS CAST(log_comment.table_id, 'String'),- lc_warehouse_query Bool ALIAS log_comment.warehouse_query,- lc_person_on_events_mode LowCardinality(String) ALIAS log_comment.person_on_events_mode,- lc_service_name String ALIAS CAST(log_comment.service_name, 'String'),- lc_workload LowCardinality(String) ALIAS log_comment.workload,- lc_query__kind LowCardinality(String) ALIAS if(JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'kind'), JSONExtractString(toString(log_comment), 'query', 'kind')),- lc_query__query String ALIAS multiIf(NOT is_initial_query, '', JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'), JSONExtractString(toString(log_comment), 'query', 'query')),- lc_query String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), ''),- lc_temporal__workflow_namespace String ALIAS CAST(log_comment.`temporal.workflow_namespace`, 'String'),- lc_temporal__workflow_type String ALIAS CAST(log_comment.`temporal.workflow_type`, 'String'),- lc_temporal__workflow_id String ALIAS CAST(log_comment.`temporal.workflow_id`, 'String'),- lc_temporal__workflow_run_id String ALIAS CAST(log_comment.`temporal.workflow_run_id`, 'String'),- lc_temporal__activity_type String ALIAS CAST(log_comment.`temporal.activity_type`, 'String'),- lc_temporal__activity_id String ALIAS CAST(log_comment.`temporal.activity_id`, 'String'),- lc_temporal__attempt Int64 ALIAS log_comment.`temporal.attempt`,- lc_dagster__job_name String ALIAS CAST(log_comment.`dagster.job_name`, 'String'),- lc_dagster__run_id String ALIAS CAST(log_comment.`dagster.run_id`, 'String'),- lc_dagster__owner String ALIAS CAST(log_comment.`dagster.tags.owner`, 'String'),- lc_modifiers String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), ''),- lc_plan_fingerprint String ALIAS ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), ''),- lc_estimated_rows Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0),- lc_estimated_bytes Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0),- ProfileEvents2 JSON(max_dynamic_paths=0, OSCPUVirtualTimeMicroseconds UInt64, ReadBufferFromS3Bytes UInt64, RealTimeMicroseconds UInt64, S3AbortMultipartUpload UInt64, S3Clients UInt64, S3CompleteMultipartUpload UInt64, S3CopyObject UInt64, S3CreateMultipartUpload UInt64, S3DeleteObjects UInt64, S3GetObject UInt64, S3GetObjectAttributes UInt64, S3HeadObject UInt64, S3ListObjects UInt64, S3PutObject UInt64, S3UploadPart UInt64, S3UploadPartCopy UInt64, WriteBufferFromS3Bytes UInt64)-) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.sharded_query_log_archive', '{replica}-{shard}') ORDER BY (team_id, event_date, event_time, query_id) PARTITION BY toYYYYMM(event_date) SETTINGS index_granularity = 8192, object_serialization_version = 'v3', object_shared_data_serialization_version = 'map_with_buckets', storage_policy = 's3_tiered';CREATE TABLE posthog.sharded_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -620,168 +521,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_buffer (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Buffer('posthog', 'sharded_query_log_archive', 16, 10, 60, 10000, 1000000, 10000000, 100000000);-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.query_log_archive_v3_buffer (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -914,39 +653,6 @@ CREATE TABLE posthog.writable_prom_metrics (unit String,help String) ENGINE = TimeSeries SAMPLES posthog.writable_prom_metrics_data TAGS posthog.writable_prom_metrics_tags METRICS posthog.writable_prom_metrics_metrics;-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -1065,40 +771,6 @@ CREATE TABLE posthog.writable_query_log_archive_v3 (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_v3_buffer');-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/dev/sessions.sql b/posthog/clickhouse/hcl/sql/dev/sessions.sqlindex 1b82e741f279..e8f3a288322e 100644--- a/posthog/clickhouse/hcl/sql/dev/sessions.sql+++ b/posthog/clickhouse/hcl/sql/dev/sessions.sql@@ -230,135 +230,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.raw_sessions (team_id Int64,session_id_v7 UInt128,@@ -505,39 +376,6 @@ CREATE TABLE posthog.web_pre_aggregated_teams (enabled_by String DEFAULT 'system',version UInt32 DEFAULT toUnixTimestamp(now())) ENGINE = Distributed('posthog_single_shard', 'posthog', 'web_pre_aggregated_teams');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -656,40 +494,6 @@ CREATE TABLE posthog.writable_query_log_archive_v3 (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_v3_buffer');-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/local-multi/ai_events.sql b/posthog/clickhouse/hcl/sql/local-multi/ai_events.sqlindex c0ae45a00919..27c572011728 100644--- a/posthog/clickhouse/hcl/sql/local-multi/ai_events.sql+++ b/posthog/clickhouse/hcl/sql/local-multi/ai_events.sql@@ -161,135 +161,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.sharded_ai_events (uuid UUID,event LowCardinality(String),@@ -362,39 +233,6 @@ CREATE TABLE posthog.sharded_ai_events (INDEX idx_is_error is_error TYPE set(2) GRANULARITY 1,INDEX idx_provider provider TYPE set(50) GRANULARITY 1) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/posthog.ai_events', '{replica}') ORDER BY (team_id, trace_id, timestamp) PARTITION BY toYYYYMM(drop_date) TTL drop_date SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1;-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -513,40 +351,6 @@ CREATE TABLE posthog.writable_query_log_archive_v3 (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_v3_buffer');-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/local-multi/auxiliary.sql b/posthog/clickhouse/hcl/sql/local-multi/auxiliary.sqlindex 6d282f1fad2f..9af2e644031d 100644--- a/posthog/clickhouse/hcl/sql/local-multi/auxiliary.sql+++ b/posthog/clickhouse/hcl/sql/local-multi/auxiliary.sql@@ -469,135 +469,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.raw_error_tracking_fingerprint_issue_state (team_id Int64,fingerprint String,@@ -1328,39 +1199,6 @@ CREATE TABLE posthog.writable_error_tracking_fingerprint_issue_state (_offset UInt64,_partition UInt64) ENGINE = Distributed('aux', 'posthog', 'raw_error_tracking_fingerprint_issue_state');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -1557,40 +1395,6 @@ CREATE MATERIALIZED VIEW posthog.message_assets_mv TO posthog.message_assets_dat_offset,_partitionFROM posthog.kafka_message_assets;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/local-multi/data.sql b/posthog/clickhouse/hcl/sql/local-multi/data.sqlindex a69f8896cb58..56ee55c8f997 100644--- a/posthog/clickhouse/hcl/sql/local-multi/data.sql+++ b/posthog/clickhouse/hcl/sql/local-multi/data.sql@@ -829,229 +829,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v2 (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception_name String ALIAS errorCodeToName(exception_code),- exception String,- stack_trace String,- ProfileEvents_RealTimeMicroseconds Int64,- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64,- ProfileEvents_S3Clients Int64,- ProfileEvents_S3DeleteObjects Int64,- ProfileEvents_S3CopyObject Int64,- ProfileEvents_S3ListObjects Int64,- ProfileEvents_S3HeadObject Int64,- ProfileEvents_S3GetObjectAttributes Int64,- ProfileEvents_S3CreateMultipartUpload Int64,- ProfileEvents_S3UploadPartCopy Int64,- ProfileEvents_S3UploadPart Int64,- ProfileEvents_S3AbortMultipartUpload Int64,- ProfileEvents_S3CompleteMultipartUpload Int64,- ProfileEvents_S3PutObject Int64,- ProfileEvents_S3GetObject Int64,- ProfileEvents_ReadBufferFromS3Bytes Int64,- ProfileEvents_WriteBufferFromS3Bytes Int64,- ProfileEvents Map(String, UInt64),- lc_workflow LowCardinality(String),- lc_kind LowCardinality(String),- lc_id String,- lc_route_id String,- lc_access_method LowCardinality(String),- lc_api_key_label String,- lc_api_key_mask String,- lc_query_type LowCardinality(String),- lc_product LowCardinality(String),- lc_chargeable Bool,- lc_name String,- lc_request_name String,- lc_client_query_id String,- lc_org_id String,- team_id Int64,- lc_user_id Int64,- lc_is_impersonated Bool,- lc_session_id String,- lc_dashboard_id Int64,- lc_insight_id Int64,- lc_cohort_id Int64,- lc_batch_export_id String,- lc_experiment_id Int64,- lc_experiment_feature_flag_key String,- lc_alert_config_id String,- lc_feature LowCardinality(String),- lc_table_id String,- lc_warehouse_query Bool,- lc_person_on_events_mode LowCardinality(String),- lc_service_name String,- lc_workload LowCardinality(String),- lc_query__kind LowCardinality(String),- lc_query__query String,- lc_query String,- lc_temporal__workflow_namespace String,- lc_temporal__workflow_type String,- lc_temporal__workflow_id String,- lc_temporal__workflow_run_id String,- lc_temporal__activity_type String,- lc_temporal__activity_id String,- lc_temporal__attempt Int64,- lc_dagster__job_name String,- lc_dagster__run_id String,- lc_dagster__owner String,- lc_modifiers String-) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.query_log_archive_new', '{replica}-{shard}') ORDER BY (team_id, event_date, event_time, query_id) PARTITION BY toYYYYMM(event_date) SETTINGS index_granularity = 8192;-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.session_replay_features (session_id String,team_id Int64,@@ -1552,100 +1329,6 @@ CREATE TABLE posthog.sharded_precalculated_person_properties (_timestamp DateTime64(6),_offset UInt64) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/{shard}/posthog.sharded_precalculated_person_properties', '{replica}', _timestamp) ORDER BY (team_id, condition, distinct_id) SETTINGS index_granularity = 8192;-CREATE TABLE posthog.sharded_query_log_archive_old (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception_name String ALIAS errorCodeToName(exception_code),- exception String,- stack_trace String,- ProfileEvents_RealTimeMicroseconds Int64,- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64,- ProfileEvents_S3Clients Int64,- ProfileEvents_S3DeleteObjects Int64,- ProfileEvents_S3CopyObject Int64,- ProfileEvents_S3ListObjects Int64,- ProfileEvents_S3HeadObject Int64,- ProfileEvents_S3GetObjectAttributes Int64,- ProfileEvents_S3CreateMultipartUpload Int64,- ProfileEvents_S3UploadPartCopy Int64,- ProfileEvents_S3UploadPart Int64,- ProfileEvents_S3AbortMultipartUpload Int64,- ProfileEvents_S3CompleteMultipartUpload Int64,- ProfileEvents_S3PutObject Int64,- ProfileEvents_S3GetObject Int64,- ProfileEvents_ReadBufferFromS3Bytes Int64,- ProfileEvents_WriteBufferFromS3Bytes Int64,- ProfileEvents Map(String, UInt64),- lc_workflow LowCardinality(String),- lc_kind LowCardinality(String),- lc_id String,- lc_route_id String,- lc_access_method LowCardinality(String),- lc_api_key_label String,- lc_api_key_mask String,- lc_query_type LowCardinality(String),- lc_product LowCardinality(String),- lc_chargeable Bool,- lc_name String,- lc_request_name String,- lc_client_query_id String,- lc_org_id String,- team_id Int64,- lc_user_id Int64,- lc_is_impersonated Bool,- lc_session_id String,- lc_dashboard_id Int64,- lc_insight_id Int64,- lc_cohort_id Int64,- lc_batch_export_id String,- lc_experiment_id Int64,- lc_experiment_feature_flag_key String,- lc_alert_config_id String,- lc_feature LowCardinality(String),- lc_table_id String,- lc_warehouse_query Bool,- lc_person_on_events_mode LowCardinality(String),- lc_service_name String,- lc_workload LowCardinality(String),- lc_query__kind LowCardinality(String),- lc_query__query String,- lc_query String,- lc_temporal__workflow_namespace String,- lc_temporal__workflow_type String,- lc_temporal__workflow_id String,- lc_temporal__workflow_run_id String,- lc_temporal__activity_type String,- lc_temporal__activity_id String,- lc_temporal__attempt Int64,- lc_dagster__job_name String,- lc_dagster__run_id String,- lc_dagster__owner String,- lc_modifiers String-) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/posthog.sharded_query_log_archive', '{replica}') ORDER BY (team_id, event_date, event_time, query_id) PARTITION BY toYYYYMM(event_date) SETTINGS index_granularity = 8192;CREATE TABLE posthog.sharded_raw_sessions (team_id Int64,session_id_v7 UInt128,@@ -2340,39 +2023,6 @@ CREATE TABLE posthog.writable_posthog_document_embeddings_text_embedding_3_small_offset UInt64,_partition UInt64) ENGINE = Distributed('posthog', 'posthog', 'sharded_posthog_document_embeddings_text_embedding_3_small_1536', cityHash64(document_id));-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -2796,40 +2446,6 @@ CREATE MATERIALIZED VIEW posthog.events_recent_json_mv TO posthog.writable_event_timestamp,_offsetFROM posthog.sharded_events;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/local-multi/ingestion_events.sql b/posthog/clickhouse/hcl/sql/local-multi/ingestion_events.sqlindex 0f08d7b80036..ed350bba6ee2 100644--- a/posthog/clickhouse/hcl/sql/local-multi/ingestion_events.sql+++ b/posthog/clickhouse/hcl/sql/local-multi/ingestion_events.sql@@ -185,135 +185,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.writable_events_json (uuid UUID,event String,diff --git a/posthog/clickhouse/hcl/sql/local-multi/ingestion_medium.sql b/posthog/clickhouse/hcl/sql/local-multi/ingestion_medium.sqlindex afe09b021232..f3fdac15b607 100644--- a/posthog/clickhouse/hcl/sql/local-multi/ingestion_medium.sql+++ b/posthog/clickhouse/hcl/sql/local-multi/ingestion_medium.sql@@ -300,135 +300,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.writable_app_metrics2 (team_id Int64,timestamp DateTime64(6, 'UTC'),diff --git a/posthog/clickhouse/hcl/sql/local-multi/ingestion_small.sql b/posthog/clickhouse/hcl/sql/local-multi/ingestion_small.sqlindex dc191b7f72a0..b1428205d2a0 100644--- a/posthog/clickhouse/hcl/sql/local-multi/ingestion_small.sql+++ b/posthog/clickhouse/hcl/sql/local-multi/ingestion_small.sql@@ -339,135 +339,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.writable_app_metrics (team_id Int64,timestamp DateTime64(6, 'UTC'),diff --git a/posthog/clickhouse/hcl/sql/local-multi/logs.sql b/posthog/clickhouse/hcl/sql/local-multi/logs.sqlindex b16b90c0da1c..29855e3d1b77 100644--- a/posthog/clickhouse/hcl/sql/local-multi/logs.sql+++ b/posthog/clickhouse/hcl/sql/local-multi/logs.sql@@ -799,135 +799,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.trace_attributes (team_id Int32,original_expiry_time_bucket DateTime64(0),diff --git a/posthog/clickhouse/hcl/sql/local-multi/ops.sql b/posthog/clickhouse/hcl/sql/local-multi/ops.sqlindex 4d8911f66193..12ee16917524 100644--- a/posthog/clickhouse/hcl/sql/local-multi/ops.sql+++ b/posthog/clickhouse/hcl/sql/local-multi/ops.sql@@ -17,104 +17,6 @@ CREATE TABLE posthog.events_team_daily_stats (event_size_histogram Array(Tuple(Float64, Float64, UInt64)),computed_at DateTime) ENGINE = ReplicatedMergeTree('/clickhouse/ops/tables/{shard}/posthog.events_team_daily_stats', '{replica}') ORDER BY (analysis_date, team_id, event) SETTINGS index_granularity = 8192;-CREATE TABLE posthog.sharded_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64),- exception_name String ALIAS errorCodeToName(exception_code),- ProfileEvents_RealTimeMicroseconds Int64 ALIAS ProfileEvents['RealTimeMicroseconds'],- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64 ALIAS ProfileEvents['OSCPUVirtualTimeMicroseconds'],- ProfileEvents_S3Clients Int64 ALIAS ProfileEvents['S3Clients'],- ProfileEvents_S3DeleteObjects Int64 ALIAS ProfileEvents['S3DeleteObjects'],- ProfileEvents_S3CopyObject Int64 ALIAS ProfileEvents['S3CopyObject'],- ProfileEvents_S3ListObjects Int64 ALIAS ProfileEvents['S3ListObjects'],- ProfileEvents_S3HeadObject Int64 ALIAS ProfileEvents['S3HeadObject'],- ProfileEvents_S3GetObjectAttributes Int64 ALIAS ProfileEvents['S3GetObjectAttributes'],- ProfileEvents_S3CreateMultipartUpload Int64 ALIAS ProfileEvents['S3CreateMultipartUpload'],- ProfileEvents_S3UploadPartCopy Int64 ALIAS ProfileEvents['S3UploadPartCopy'],- ProfileEvents_S3UploadPart Int64 ALIAS ProfileEvents['S3UploadPart'],- ProfileEvents_S3AbortMultipartUpload Int64 ALIAS ProfileEvents['S3AbortMultipartUpload'],- ProfileEvents_S3CompleteMultipartUpload Int64 ALIAS ProfileEvents['S3CompleteMultipartUpload'],- ProfileEvents_S3PutObject Int64 ALIAS ProfileEvents['S3PutObject'],- ProfileEvents_S3GetObject Int64 ALIAS ProfileEvents['S3GetObject'],- ProfileEvents_ReadBufferFromS3Bytes Int64 ALIAS ProfileEvents['ReadBufferFromS3Bytes'],- ProfileEvents_WriteBufferFromS3Bytes Int64 ALIAS ProfileEvents['WriteBufferFromS3Bytes'],- lc_workflow LowCardinality(String) ALIAS log_comment.workflow,- lc_kind LowCardinality(String) ALIAS log_comment.kind,- lc_id String ALIAS CAST(log_comment.id, 'String'),- lc_route_id String ALIAS CAST(log_comment.route_id, 'String'),- lc_access_method LowCardinality(String) ALIAS log_comment.access_method,- lc_api_key_label String ALIAS CAST(log_comment.api_key_label, 'String'),- lc_api_key_mask String ALIAS CAST(log_comment.api_key_mask, 'String'),- lc_query_type LowCardinality(String) ALIAS log_comment.query_type,- lc_product LowCardinality(String) ALIAS log_comment.product,- lc_chargeable Bool ALIAS log_comment.chargeable,- lc_name String ALIAS CAST(log_comment.name, 'String'),- lc_request_name String ALIAS CAST(log_comment.request_name, 'String'),- lc_client_query_id String ALIAS CAST(log_comment.client_query_id, 'String'),- lc_org_id String ALIAS CAST(log_comment.org_id, 'String'),- lc_user_id Int64 ALIAS log_comment.user_id,- lc_is_impersonated Bool ALIAS log_comment.is_impersonated,- lc_session_id String ALIAS CAST(log_comment.session_id, 'String'),- lc_dashboard_id Int64 ALIAS log_comment.dashboard_id,- lc_insight_id Int64 ALIAS log_comment.insight_id,- lc_cohort_id Int64 ALIAS log_comment.cohort_id,- lc_batch_export_id String ALIAS CAST(log_comment.batch_export_id, 'String'),- lc_experiment_id Int64 ALIAS log_comment.experiment_id,- lc_experiment_feature_flag_key String ALIAS CAST(log_comment.experiment_feature_flag_key, 'String'),- lc_alert_config_id String ALIAS CAST(log_comment.alert_config_id, 'String'),- lc_feature LowCardinality(String) ALIAS log_comment.feature,- lc_table_id String ALIAS CAST(log_comment.table_id, 'String'),- lc_warehouse_query Bool ALIAS log_comment.warehouse_query,- lc_person_on_events_mode LowCardinality(String) ALIAS log_comment.person_on_events_mode,- lc_service_name String ALIAS CAST(log_comment.service_name, 'String'),- lc_workload LowCardinality(String) ALIAS log_comment.workload,- lc_query__kind LowCardinality(String) ALIAS if(JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'kind'), JSONExtractString(toString(log_comment), 'query', 'kind')),- lc_query__query String ALIAS multiIf(NOT is_initial_query, '', JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'), JSONExtractString(toString(log_comment), 'query', 'query')),- lc_query String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), ''),- lc_temporal__workflow_namespace String ALIAS CAST(log_comment.`temporal.workflow_namespace`, 'String'),- lc_temporal__workflow_type String ALIAS CAST(log_comment.`temporal.workflow_type`, 'String'),- lc_temporal__workflow_id String ALIAS CAST(log_comment.`temporal.workflow_id`, 'String'),- lc_temporal__workflow_run_id String ALIAS CAST(log_comment.`temporal.workflow_run_id`, 'String'),- lc_temporal__activity_type String ALIAS CAST(log_comment.`temporal.activity_type`, 'String'),- lc_temporal__activity_id String ALIAS CAST(log_comment.`temporal.activity_id`, 'String'),- lc_temporal__attempt Int64 ALIAS log_comment.`temporal.attempt`,- lc_dagster__job_name String ALIAS CAST(log_comment.`dagster.job_name`, 'String'),- lc_dagster__run_id String ALIAS CAST(log_comment.`dagster.run_id`, 'String'),- lc_dagster__owner String ALIAS CAST(log_comment.`dagster.tags.owner`, 'String'),- lc_modifiers String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), ''),- lc_plan_fingerprint String ALIAS ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), ''),- lc_estimated_rows Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0),- lc_estimated_bytes Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0)-) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.sharded_query_log_archive', '{replica}-{shard}') ORDER BY (team_id, event_date, event_time, query_id) PARTITION BY toYYYYMM(event_date) SETTINGS index_granularity = 8192, object_serialization_version = 'v3', object_shared_data_serialization_version = 'map_with_buckets';CREATE TABLE posthog.sharded_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -478,168 +380,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_buffer (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Buffer('posthog', 'sharded_query_log_archive', 16, 10, 60, 10000, 1000000, 10000000, 100000000);-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.query_log_archive_v3_buffer (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -758,39 +498,6 @@ CREATE TABLE posthog.query_log_archive_v3_buffer (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Buffer('posthog', 'sharded_query_log_archive_v3', 16, 10, 60, 10000, 1000000, 10000000, 100000000);-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -909,40 +616,6 @@ CREATE TABLE posthog.writable_query_log_archive_v3 (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_v3_buffer');-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/local-multi/sessions.sql b/posthog/clickhouse/hcl/sql/local-multi/sessions.sqlindex 282325ba283e..d752d36a3758 100644--- a/posthog/clickhouse/hcl/sql/local-multi/sessions.sql+++ b/posthog/clickhouse/hcl/sql/local-multi/sessions.sql@@ -130,168 +130,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -410,40 +248,6 @@ CREATE TABLE posthog.writable_query_log_archive_v3 (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_v3_buffer');-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/local-single/all.sql b/posthog/clickhouse/hcl/sql/local-single/all.sqlindex 75e2ba733630..0055ecbf3ace 100644--- a/posthog/clickhouse/hcl/sql/local-single/all.sql+++ b/posthog/clickhouse/hcl/sql/local-single/all.sql@@ -1768,100 +1768,6 @@ CREATE TABLE posthog.property_values_distributed (property_count SimpleAggregateFunction(sum, UInt64),last_seen SimpleAggregateFunction(max, DateTime) DEFAULT now()) ENGINE = Distributed('aux', 'posthog', 'property_values');-CREATE TABLE posthog.query_log_archive_v2 (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception_name String ALIAS errorCodeToName(exception_code),- exception String,- stack_trace String,- ProfileEvents_RealTimeMicroseconds Int64,- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64,- ProfileEvents_S3Clients Int64,- ProfileEvents_S3DeleteObjects Int64,- ProfileEvents_S3CopyObject Int64,- ProfileEvents_S3ListObjects Int64,- ProfileEvents_S3HeadObject Int64,- ProfileEvents_S3GetObjectAttributes Int64,- ProfileEvents_S3CreateMultipartUpload Int64,- ProfileEvents_S3UploadPartCopy Int64,- ProfileEvents_S3UploadPart Int64,- ProfileEvents_S3AbortMultipartUpload Int64,- ProfileEvents_S3CompleteMultipartUpload Int64,- ProfileEvents_S3PutObject Int64,- ProfileEvents_S3GetObject Int64,- ProfileEvents_ReadBufferFromS3Bytes Int64,- ProfileEvents_WriteBufferFromS3Bytes Int64,- ProfileEvents Map(String, UInt64),- lc_workflow LowCardinality(String),- lc_kind LowCardinality(String),- lc_id String,- lc_route_id String,- lc_access_method LowCardinality(String),- lc_api_key_label String,- lc_api_key_mask String,- lc_query_type LowCardinality(String),- lc_product LowCardinality(String),- lc_chargeable Bool,- lc_name String,- lc_request_name String,- lc_client_query_id String,- lc_org_id String,- team_id Int64,- lc_user_id Int64,- lc_is_impersonated Bool,- lc_session_id String,- lc_dashboard_id Int64,- lc_insight_id Int64,- lc_cohort_id Int64,- lc_batch_export_id String,- lc_experiment_id Int64,- lc_experiment_feature_flag_key String,- lc_alert_config_id String,- lc_feature LowCardinality(String),- lc_table_id String,- lc_warehouse_query Bool,- lc_person_on_events_mode LowCardinality(String),- lc_service_name String,- lc_workload LowCardinality(String),- lc_query__kind LowCardinality(String),- lc_query__query String,- lc_query String,- lc_temporal__workflow_namespace String,- lc_temporal__workflow_type String,- lc_temporal__workflow_id String,- lc_temporal__workflow_run_id String,- lc_temporal__activity_type String,- lc_temporal__activity_id String,- lc_temporal__attempt Int64,- lc_dagster__job_name String,- lc_dagster__run_id String,- lc_dagster__owner String,- lc_modifiers String-) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.query_log_archive_new', '{replica}-{shard}') ORDER BY (team_id, event_date, event_time, query_id) PARTITION BY toYYYYMM(event_date) SETTINGS index_granularity = 8192;CREATE TABLE posthog.raw_error_tracking_fingerprint_issue_state (team_id Int64,fingerprint String,@@ -2519,198 +2425,6 @@ CREATE TABLE posthog.sharded_precalculated_person_properties (_timestamp DateTime64(6),_offset UInt64) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/{shard}/posthog.sharded_precalculated_person_properties', '{replica}', _timestamp) ORDER BY (team_id, condition, distinct_id) SETTINGS index_granularity = 8192;-CREATE TABLE posthog.sharded_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64),- exception_name String ALIAS errorCodeToName(exception_code),- ProfileEvents_RealTimeMicroseconds Int64 ALIAS ProfileEvents['RealTimeMicroseconds'],- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64 ALIAS ProfileEvents['OSCPUVirtualTimeMicroseconds'],- ProfileEvents_S3Clients Int64 ALIAS ProfileEvents['S3Clients'],- ProfileEvents_S3DeleteObjects Int64 ALIAS ProfileEvents['S3DeleteObjects'],- ProfileEvents_S3CopyObject Int64 ALIAS ProfileEvents['S3CopyObject'],- ProfileEvents_S3ListObjects Int64 ALIAS ProfileEvents['S3ListObjects'],- ProfileEvents_S3HeadObject Int64 ALIAS ProfileEvents['S3HeadObject'],- ProfileEvents_S3GetObjectAttributes Int64 ALIAS ProfileEvents['S3GetObjectAttributes'],- ProfileEvents_S3CreateMultipartUpload Int64 ALIAS ProfileEvents['S3CreateMultipartUpload'],- ProfileEvents_S3UploadPartCopy Int64 ALIAS ProfileEvents['S3UploadPartCopy'],- ProfileEvents_S3UploadPart Int64 ALIAS ProfileEvents['S3UploadPart'],- ProfileEvents_S3AbortMultipartUpload Int64 ALIAS ProfileEvents['S3AbortMultipartUpload'],- ProfileEvents_S3CompleteMultipartUpload Int64 ALIAS ProfileEvents['S3CompleteMultipartUpload'],- ProfileEvents_S3PutObject Int64 ALIAS ProfileEvents['S3PutObject'],- ProfileEvents_S3GetObject Int64 ALIAS ProfileEvents['S3GetObject'],- ProfileEvents_ReadBufferFromS3Bytes Int64 ALIAS ProfileEvents['ReadBufferFromS3Bytes'],- ProfileEvents_WriteBufferFromS3Bytes Int64 ALIAS ProfileEvents['WriteBufferFromS3Bytes'],- lc_workflow LowCardinality(String) ALIAS log_comment.workflow,- lc_kind LowCardinality(String) ALIAS log_comment.kind,- lc_id String ALIAS CAST(log_comment.id, 'String'),- lc_route_id String ALIAS CAST(log_comment.route_id, 'String'),- lc_access_method LowCardinality(String) ALIAS log_comment.access_method,- lc_api_key_label String ALIAS CAST(log_comment.api_key_label, 'String'),- lc_api_key_mask String ALIAS CAST(log_comment.api_key_mask, 'String'),- lc_query_type LowCardinality(String) ALIAS log_comment.query_type,- lc_product LowCardinality(String) ALIAS log_comment.product,- lc_chargeable Bool ALIAS log_comment.chargeable,- lc_name String ALIAS CAST(log_comment.name, 'String'),- lc_request_name String ALIAS CAST(log_comment.request_name, 'String'),- lc_client_query_id String ALIAS CAST(log_comment.client_query_id, 'String'),- lc_org_id String ALIAS CAST(log_comment.org_id, 'String'),- lc_user_id Int64 ALIAS log_comment.user_id,- lc_is_impersonated Bool ALIAS log_comment.is_impersonated,- lc_session_id String ALIAS CAST(log_comment.session_id, 'String'),- lc_dashboard_id Int64 ALIAS log_comment.dashboard_id,- lc_insight_id Int64 ALIAS log_comment.insight_id,- lc_cohort_id Int64 ALIAS log_comment.cohort_id,- lc_batch_export_id String ALIAS CAST(log_comment.batch_export_id, 'String'),- lc_experiment_id Int64 ALIAS log_comment.experiment_id,- lc_experiment_feature_flag_key String ALIAS CAST(log_comment.experiment_feature_flag_key, 'String'),- lc_alert_config_id String ALIAS CAST(log_comment.alert_config_id, 'String'),- lc_feature LowCardinality(String) ALIAS log_comment.feature,- lc_table_id String ALIAS CAST(log_comment.table_id, 'String'),- lc_warehouse_query Bool ALIAS log_comment.warehouse_query,- lc_person_on_events_mode LowCardinality(String) ALIAS log_comment.person_on_events_mode,- lc_service_name String ALIAS CAST(log_comment.service_name, 'String'),- lc_workload LowCardinality(String) ALIAS log_comment.workload,- lc_query__kind LowCardinality(String) ALIAS if(JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'kind'), JSONExtractString(toString(log_comment), 'query', 'kind')),- lc_query__query String ALIAS multiIf(NOT is_initial_query, '', JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'), JSONExtractString(toString(log_comment), 'query', 'query')),- lc_query String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), ''),- lc_temporal__workflow_namespace String ALIAS CAST(log_comment.`temporal.workflow_namespace`, 'String'),- lc_temporal__workflow_type String ALIAS CAST(log_comment.`temporal.workflow_type`, 'String'),- lc_temporal__workflow_id String ALIAS CAST(log_comment.`temporal.workflow_id`, 'String'),- lc_temporal__workflow_run_id String ALIAS CAST(log_comment.`temporal.workflow_run_id`, 'String'),- lc_temporal__activity_type String ALIAS CAST(log_comment.`temporal.activity_type`, 'String'),- lc_temporal__activity_id String ALIAS CAST(log_comment.`temporal.activity_id`, 'String'),- lc_temporal__attempt Int64 ALIAS log_comment.`temporal.attempt`,- lc_dagster__job_name String ALIAS CAST(log_comment.`dagster.job_name`, 'String'),- lc_dagster__run_id String ALIAS CAST(log_comment.`dagster.run_id`, 'String'),- lc_dagster__owner String ALIAS CAST(log_comment.`dagster.tags.owner`, 'String'),- lc_modifiers String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), ''),- lc_plan_fingerprint String ALIAS ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), ''),- lc_estimated_rows Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0),- lc_estimated_bytes Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0)-) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.sharded_query_log_archive', '{replica}-{shard}') ORDER BY (team_id, event_date, event_time, query_id) PARTITION BY toYYYYMM(event_date) SETTINGS index_granularity = 8192, object_serialization_version = 'v3', object_shared_data_serialization_version = 'map_with_buckets';-CREATE TABLE posthog.sharded_query_log_archive_old (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception_name String ALIAS errorCodeToName(exception_code),- exception String,- stack_trace String,- ProfileEvents_RealTimeMicroseconds Int64,- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64,- ProfileEvents_S3Clients Int64,- ProfileEvents_S3DeleteObjects Int64,- ProfileEvents_S3CopyObject Int64,- ProfileEvents_S3ListObjects Int64,- ProfileEvents_S3HeadObject Int64,- ProfileEvents_S3GetObjectAttributes Int64,- ProfileEvents_S3CreateMultipartUpload Int64,- ProfileEvents_S3UploadPartCopy Int64,- ProfileEvents_S3UploadPart Int64,- ProfileEvents_S3AbortMultipartUpload Int64,- ProfileEvents_S3CompleteMultipartUpload Int64,- ProfileEvents_S3PutObject Int64,- ProfileEvents_S3GetObject Int64,- ProfileEvents_ReadBufferFromS3Bytes Int64,- ProfileEvents_WriteBufferFromS3Bytes Int64,- ProfileEvents Map(String, UInt64),- lc_workflow LowCardinality(String),- lc_kind LowCardinality(String),- lc_id String,- lc_route_id String,- lc_access_method LowCardinality(String),- lc_api_key_label String,- lc_api_key_mask String,- lc_query_type LowCardinality(String),- lc_product LowCardinality(String),- lc_chargeable Bool,- lc_name String,- lc_request_name String,- lc_client_query_id String,- lc_org_id String,- team_id Int64,- lc_user_id Int64,- lc_is_impersonated Bool,- lc_session_id String,- lc_dashboard_id Int64,- lc_insight_id Int64,- lc_cohort_id Int64,- lc_batch_export_id String,- lc_experiment_id Int64,- lc_experiment_feature_flag_key String,- lc_alert_config_id String,- lc_feature LowCardinality(String),- lc_table_id String,- lc_warehouse_query Bool,- lc_person_on_events_mode LowCardinality(String),- lc_service_name String,- lc_workload LowCardinality(String),- lc_query__kind LowCardinality(String),- lc_query__query String,- lc_query String,- lc_temporal__workflow_namespace String,- lc_temporal__workflow_type String,- lc_temporal__workflow_id String,- lc_temporal__workflow_run_id String,- lc_temporal__activity_type String,- lc_temporal__activity_id String,- lc_temporal__attempt Int64,- lc_dagster__job_name String,- lc_dagster__run_id String,- lc_dagster__owner String,- lc_modifiers String-) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/posthog.sharded_query_log_archive', '{replica}') ORDER BY (team_id, event_date, event_time, query_id) PARTITION BY toYYYYMM(event_date) SETTINGS index_granularity = 8192;CREATE TABLE posthog.sharded_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -7347,168 +7061,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_buffer (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Buffer('posthog', 'sharded_query_log_archive', 16, 10, 60, 10000, 1000000, 10000000, 100000000);-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.query_log_archive_v3_buffer (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -7880,39 +7432,6 @@ CREATE TABLE posthog.sessions (pageview_count SimpleAggregateFunction(sum, Int64),autocapture_count SimpleAggregateFunction(sum, Int64)) ENGINE = Distributed('posthog', 'posthog', 'sharded_sessions', sipHash64(session_id));-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -8104,40 +7623,6 @@ CREATE MATERIALIZED VIEW posthog.ai_events_json_mv TO posthog.ai_events (uuid UU_offset,_partitionFROM posthog.kafka_ai_events_json AS src;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-eu/ai_events.sql b/posthog/clickhouse/hcl/sql/prod-eu/ai_events.sqlindex ca572731ca6c..70decd77510f 100644--- a/posthog/clickhouse/hcl/sql/prod-eu/ai_events.sql+++ b/posthog/clickhouse/hcl/sql/prod-eu/ai_events.sql@@ -233,168 +233,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -586,40 +424,6 @@ CREATE MATERIALIZED VIEW posthog.ai_events_json_ws_mv TO posthog.ai_events (uuid_offset,_partitionFROM posthog.kafka_ai_events_json_ws AS src;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-eu/apm.sql b/posthog/clickhouse/hcl/sql/prod-eu/apm.sqlindex a824f12cd4dc..116fb599fbb3 100644--- a/posthog/clickhouse/hcl/sql/prod-eu/apm.sql+++ b/posthog/clickhouse/hcl/sql/prod-eu/apm.sql@@ -116,39 +116,6 @@ CREATE TABLE posthog.writable_metrics4_series (time_bucket DateTime MATERIALIZED toStartOfHour(timestamp),original_expiry_timestamp DateTime64(6)) ENGINE = Distributed('logs', 'posthog', 'metrics4_series');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -430,40 +397,6 @@ CREATE MATERIALIZED VIEW posthog.metrics4_input_to_metrics4_series TO posthog.wroriginal_expiry_timestampFROM posthog.metrics4_inputWHERE has_labels;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-eu/auxiliary.sql b/posthog/clickhouse/hcl/sql/prod-eu/auxiliary.sqlindex 4539f18d2a0b..b96c78e0ce8e 100644--- a/posthog/clickhouse/hcl/sql/prod-eu/auxiliary.sql+++ b/posthog/clickhouse/hcl/sql/prod-eu/auxiliary.sql@@ -455,135 +455,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.raw_error_tracking_fingerprint_issue_state (team_id Int64,fingerprint String,@@ -1324,39 +1195,6 @@ CREATE TABLE posthog.writable_error_tracking_fingerprint_issue_state (_offset UInt64,_partition UInt64) ENGINE = Distributed('aux', 'posthog', 'raw_error_tracking_fingerprint_issue_state');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -1536,40 +1374,6 @@ CREATE MATERIALIZED VIEW posthog.message_assets_mv TO posthog.message_assets_dat_offset,_partitionFROM posthog.kafka_message_assets;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-eu/batch_exports.sql b/posthog/clickhouse/hcl/sql/prod-eu/batch_exports.sqlindex 4f0a67cc7b01..67f3bff5dcd7 100644--- a/posthog/clickhouse/hcl/sql/prod-eu/batch_exports.sql+++ b/posthog/clickhouse/hcl/sql/prod-eu/batch_exports.sql@@ -130,135 +130,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.sharded_events_recent (uuid UUID,event String,@@ -287,39 +158,6 @@ CREATE TABLE posthog.sharded_events_recent (_offset UInt64,inserted_at DateTime64(6, 'UTC') DEFAULT now64()) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/batch_exports/{shard}/posthog.sharded_events_recent', '{replica}', _timestamp) ORDER BY (team_id, toStartOfHour(inserted_at), event, cityHash64(distinct_id), cityHash64(uuid)) PARTITION BY toStartOfDay(inserted_at) TTL toDate(inserted_at) + toIntervalDay(9) SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1;-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -438,40 +276,6 @@ CREATE TABLE posthog.writable_query_log_archive_v3 (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_v3_buffer');-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-eu/data.sql b/posthog/clickhouse/hcl/sql/prod-eu/data.sqlindex 25dfae15e218..54935412da5f 100644--- a/posthog/clickhouse/hcl/sql/prod-eu/data.sql+++ b/posthog/clickhouse/hcl/sql/prod-eu/data.sql@@ -1078,135 +1078,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.raw_sessions (team_id Int64,session_id_v7 UInt128,@@ -2382,39 +2253,6 @@ CREATE TABLE posthog.writable_posthog_document_embeddings_text_embedding_3_small_offset UInt64,_partition UInt64) ENGINE = Distributed('posthog', 'posthog', 'sharded_posthog_document_embeddings_text_embedding_3_small_1536', cityHash64(document_id));-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -2770,40 +2608,6 @@ CREATE TABLE posthog.writeable_performance_events (_offset UInt64,_partition UInt64) ENGINE = Distributed('posthog', 'posthog', 'sharded_performance_events', sipHash64(session_id));-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-eu/logs.sql b/posthog/clickhouse/hcl/sql/prod-eu/logs.sqlindex 9ba20e83d25d..901a02ec09ae 100644--- a/posthog/clickhouse/hcl/sql/prod-eu/logs.sql+++ b/posthog/clickhouse/hcl/sql/prod-eu/logs.sql@@ -731,135 +731,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.trace_attributes (team_id Int32,original_expiry_time_bucket DateTime64(0),@@ -1021,39 +892,6 @@ CREATE TABLE posthog.trace_spans_kafka_metrics (max_created_at SimpleAggregateFunction(max, DateTime64(9)),max_lag SimpleAggregateFunction(max, UInt64)) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.trace_spans_kafka_metrics', '{replica}-{shard}') ORDER BY (_topic, _partition) SETTINGS index_granularity = 8192;-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -1393,40 +1231,6 @@ FROM)GROUP BYteam_id, time_bucket, service_name, namespace, environment, severity_text;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-eu/ops.sql b/posthog/clickhouse/hcl/sql/prod-eu/ops.sqlindex dcb76870a274..48733ec2e56c 100644--- a/posthog/clickhouse/hcl/sql/prod-eu/ops.sql+++ b/posthog/clickhouse/hcl/sql/prod-eu/ops.sql@@ -141,104 +141,6 @@ CREATE TABLE posthog.query_team_daily_stats (query_kind_counts Map(String, UInt64) COMMENT 'query_kind -> count for QueryFinish rows.',computed_at DateTime) ENGINE = ReplicatedMergeTree('/clickhouse/ops/tables/{shard}/posthog.query_team_daily_stats', '{replica}') ORDER BY (analysis_date, team_id) TTL analysis_date + toIntervalDay(90) SETTINGS index_granularity = 8192;-CREATE TABLE posthog.sharded_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64),- exception_name String ALIAS errorCodeToName(exception_code),- ProfileEvents_RealTimeMicroseconds Int64 ALIAS ProfileEvents['RealTimeMicroseconds'],- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64 ALIAS ProfileEvents['OSCPUVirtualTimeMicroseconds'],- ProfileEvents_S3Clients Int64 ALIAS ProfileEvents['S3Clients'],- ProfileEvents_S3DeleteObjects Int64 ALIAS ProfileEvents['S3DeleteObjects'],- ProfileEvents_S3CopyObject Int64 ALIAS ProfileEvents['S3CopyObject'],- ProfileEvents_S3ListObjects Int64 ALIAS ProfileEvents['S3ListObjects'],- ProfileEvents_S3HeadObject Int64 ALIAS ProfileEvents['S3HeadObject'],- ProfileEvents_S3GetObjectAttributes Int64 ALIAS ProfileEvents['S3GetObjectAttributes'],- ProfileEvents_S3CreateMultipartUpload Int64 ALIAS ProfileEvents['S3CreateMultipartUpload'],- ProfileEvents_S3UploadPartCopy Int64 ALIAS ProfileEvents['S3UploadPartCopy'],- ProfileEvents_S3UploadPart Int64 ALIAS ProfileEvents['S3UploadPart'],- ProfileEvents_S3AbortMultipartUpload Int64 ALIAS ProfileEvents['S3AbortMultipartUpload'],- ProfileEvents_S3CompleteMultipartUpload Int64 ALIAS ProfileEvents['S3CompleteMultipartUpload'],- ProfileEvents_S3PutObject Int64 ALIAS ProfileEvents['S3PutObject'],- ProfileEvents_S3GetObject Int64 ALIAS ProfileEvents['S3GetObject'],- ProfileEvents_ReadBufferFromS3Bytes Int64 ALIAS ProfileEvents['ReadBufferFromS3Bytes'],- ProfileEvents_WriteBufferFromS3Bytes Int64 ALIAS ProfileEvents['WriteBufferFromS3Bytes'],- lc_workflow LowCardinality(String) ALIAS log_comment.workflow,- lc_kind LowCardinality(String) ALIAS log_comment.kind,- lc_id String ALIAS CAST(log_comment.id, 'String'),- lc_route_id String ALIAS CAST(log_comment.route_id, 'String'),- lc_access_method LowCardinality(String) ALIAS log_comment.access_method,- lc_api_key_label String ALIAS CAST(log_comment.api_key_label, 'String'),- lc_api_key_mask String ALIAS CAST(log_comment.api_key_mask, 'String'),- lc_query_type LowCardinality(String) ALIAS log_comment.query_type,- lc_product LowCardinality(String) ALIAS log_comment.product,- lc_chargeable Bool ALIAS log_comment.chargeable,- lc_name String ALIAS CAST(log_comment.name, 'String'),- lc_request_name String ALIAS CAST(log_comment.request_name, 'String'),- lc_client_query_id String ALIAS CAST(log_comment.client_query_id, 'String'),- lc_org_id String ALIAS CAST(log_comment.org_id, 'String'),- lc_user_id Int64 ALIAS log_comment.user_id,- lc_is_impersonated Bool ALIAS log_comment.is_impersonated,- lc_session_id String ALIAS CAST(log_comment.session_id, 'String'),- lc_dashboard_id Int64 ALIAS log_comment.dashboard_id,- lc_insight_id Int64 ALIAS log_comment.insight_id,- lc_cohort_id Int64 ALIAS log_comment.cohort_id,- lc_batch_export_id String ALIAS CAST(log_comment.batch_export_id, 'String'),- lc_experiment_id Int64 ALIAS log_comment.experiment_id,- lc_experiment_feature_flag_key String ALIAS CAST(log_comment.experiment_feature_flag_key, 'String'),- lc_alert_config_id String ALIAS CAST(log_comment.alert_config_id, 'String'),- lc_feature LowCardinality(String) ALIAS log_comment.feature,- lc_table_id String ALIAS CAST(log_comment.table_id, 'String'),- lc_warehouse_query Bool ALIAS log_comment.warehouse_query,- lc_person_on_events_mode LowCardinality(String) ALIAS log_comment.person_on_events_mode,- lc_service_name String ALIAS CAST(log_comment.service_name, 'String'),- lc_workload LowCardinality(String) ALIAS log_comment.workload,- lc_query__kind LowCardinality(String) ALIAS if(JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'kind'), JSONExtractString(toString(log_comment), 'query', 'kind')),- lc_query__query String ALIAS multiIf(NOT is_initial_query, '', JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'), JSONExtractString(toString(log_comment), 'query', 'query')),- lc_query String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), ''),- lc_temporal__workflow_namespace String ALIAS CAST(log_comment.`temporal.workflow_namespace`, 'String'),- lc_temporal__workflow_type String ALIAS CAST(log_comment.`temporal.workflow_type`, 'String'),- lc_temporal__workflow_id String ALIAS CAST(log_comment.`temporal.workflow_id`, 'String'),- lc_temporal__workflow_run_id String ALIAS CAST(log_comment.`temporal.workflow_run_id`, 'String'),- lc_temporal__activity_type String ALIAS CAST(log_comment.`temporal.activity_type`, 'String'),- lc_temporal__activity_id String ALIAS CAST(log_comment.`temporal.activity_id`, 'String'),- lc_temporal__attempt Int64 ALIAS log_comment.`temporal.attempt`,- lc_dagster__job_name String ALIAS CAST(log_comment.`dagster.job_name`, 'String'),- lc_dagster__run_id String ALIAS CAST(log_comment.`dagster.run_id`, 'String'),- lc_dagster__owner String ALIAS CAST(log_comment.`dagster.tags.owner`, 'String'),- lc_modifiers String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), ''),- lc_plan_fingerprint String ALIAS ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), ''),- lc_estimated_rows Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0),- lc_estimated_bytes Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0)-) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.sharded_query_log_archive', '{replica}-{shard}') ORDER BY (team_id, event_date, event_time, query_id) PARTITION BY toYYYYMM(event_date) SETTINGS index_granularity = 8192, max_replicated_merges_in_queue = 6, object_serialization_version = 'v3', object_shared_data_serialization_version = 'map_with_buckets', parts_to_delay_insert = 1000, parts_to_throw_insert = 3000, prefer_fetch_merged_part_size_threshold = 1, prefer_fetch_merged_part_time_threshold = 60;CREATE TABLE posthog.sharded_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -621,168 +523,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_buffer (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Buffer('posthog', 'sharded_query_log_archive', 16, 10, 60, 10000, 1000000, 10000000, 100000000);-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.query_log_archive_v3_buffer (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -901,39 +641,6 @@ CREATE TABLE posthog.query_log_archive_v3_buffer (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Buffer('posthog', 'sharded_query_log_archive_v3', 16, 10, 60, 10000, 1000000, 10000000, 100000000);-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -1052,40 +759,6 @@ CREATE TABLE posthog.writable_query_log_archive_v3 (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_v3_buffer');-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-eu/sessions.sql b/posthog/clickhouse/hcl/sql/prod-eu/sessions.sqlindex 7630cedf7e16..085954cd688b 100644--- a/posthog/clickhouse/hcl/sql/prod-eu/sessions.sql+++ b/posthog/clickhouse/hcl/sql/prod-eu/sessions.sql@@ -230,135 +230,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.raw_sessions (team_id Int64,session_id_v7 UInt128,@@ -505,39 +376,6 @@ CREATE TABLE posthog.web_pre_aggregated_teams (enabled_by String DEFAULT 'system',version UInt32 DEFAULT toUnixTimestamp(now())) ENGINE = Distributed('posthog_single_shard', 'posthog', 'web_pre_aggregated_teams');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -656,40 +494,6 @@ CREATE TABLE posthog.writable_query_log_archive_v3 (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_v3_buffer');-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-us/ai_events.sql b/posthog/clickhouse/hcl/sql/prod-us/ai_events.sqlindex 2aa02b1873dd..cecbba744767 100644--- a/posthog/clickhouse/hcl/sql/prod-us/ai_events.sql+++ b/posthog/clickhouse/hcl/sql/prod-us/ai_events.sql@@ -233,168 +233,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -586,40 +424,6 @@ CREATE MATERIALIZED VIEW posthog.ai_events_json_ws_mv TO posthog.ai_events (uuid_offset,_partitionFROM posthog.kafka_ai_events_json_ws AS src;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-us/apm.sql b/posthog/clickhouse/hcl/sql/prod-us/apm.sqlindex e6f1b2ea6504..08c12fa44e5f 100644--- a/posthog/clickhouse/hcl/sql/prod-us/apm.sql+++ b/posthog/clickhouse/hcl/sql/prod-us/apm.sql@@ -116,39 +116,6 @@ CREATE TABLE posthog.writable_metrics4_series (time_bucket DateTime MATERIALIZED toStartOfHour(timestamp),original_expiry_timestamp DateTime64(6)) ENGINE = Distributed('logs', 'posthog', 'metrics4_series');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -430,40 +397,6 @@ CREATE MATERIALIZED VIEW posthog.metrics4_input_to_metrics4_series TO posthog.wroriginal_expiry_timestampFROM posthog.metrics4_inputWHERE has_labels;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-us/auxiliary.sql b/posthog/clickhouse/hcl/sql/prod-us/auxiliary.sqlindex c0ee8a8233f7..028106f3ffef 100644--- a/posthog/clickhouse/hcl/sql/prod-us/auxiliary.sql+++ b/posthog/clickhouse/hcl/sql/prod-us/auxiliary.sql@@ -455,135 +455,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.raw_error_tracking_fingerprint_issue_state (team_id Int64,fingerprint String,@@ -1324,39 +1195,6 @@ CREATE TABLE posthog.writable_error_tracking_fingerprint_issue_state (_offset UInt64,_partition UInt64) ENGINE = Distributed('aux', 'posthog', 'raw_error_tracking_fingerprint_issue_state');-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -1536,40 +1374,6 @@ CREATE MATERIALIZED VIEW posthog.message_assets_mv TO posthog.message_assets_dat_offset,_partitionFROM posthog.kafka_message_assets;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-us/batch_exports.sql b/posthog/clickhouse/hcl/sql/prod-us/batch_exports.sqlindex 9cd8e4b02611..8d18e68f9364 100644--- a/posthog/clickhouse/hcl/sql/prod-us/batch_exports.sql+++ b/posthog/clickhouse/hcl/sql/prod-us/batch_exports.sql@@ -130,135 +130,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.sharded_events_recent (uuid UUID,event String,@@ -286,39 +157,6 @@ CREATE TABLE posthog.sharded_events_recent (_offset UInt64,inserted_at DateTime64(6, 'UTC') DEFAULT now64()) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/batch_exports/{shard}/posthog.sharded_events_recent', '{replica}', _timestamp) ORDER BY (team_id, toStartOfHour(inserted_at), event, cityHash64(distinct_id), cityHash64(uuid)) PARTITION BY toStartOfDay(inserted_at) TTL toDate(inserted_at) + toIntervalDay(9) SETTINGS index_granularity = 8192, parts_to_delay_insert = 800, parts_to_throw_insert = 1500, ttl_only_drop_parts = 1;-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -437,40 +275,6 @@ CREATE TABLE posthog.writable_query_log_archive_v3 (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_v3_buffer');-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-us/data.sql b/posthog/clickhouse/hcl/sql/prod-us/data.sqlindex a293b5c79c09..97a43021644f 100644--- a/posthog/clickhouse/hcl/sql/prod-us/data.sql+++ b/posthog/clickhouse/hcl/sql/prod-us/data.sql@@ -947,135 +947,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.raw_sessions (team_id Int64,session_id_v7 UInt128,@@ -2179,39 +2050,6 @@ CREATE TABLE posthog.writable_posthog_document_embeddings_text_embedding_3_small_offset UInt64,_partition UInt64) ENGINE = Distributed('posthog', 'posthog', 'sharded_posthog_document_embeddings_text_embedding_3_small_1536', cityHash64(document_id));-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -2601,40 +2439,6 @@ CREATE TABLE posthog.writeable_performance_events (_offset UInt64,_partition UInt64) ENGINE = Distributed('posthog', 'posthog', 'sharded_performance_events', sipHash64(session_id));-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-us/logs.sql b/posthog/clickhouse/hcl/sql/prod-us/logs.sqlindex a35e2cf985de..41774e55abc8 100644--- a/posthog/clickhouse/hcl/sql/prod-us/logs.sql+++ b/posthog/clickhouse/hcl/sql/prod-us/logs.sql@@ -731,135 +731,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.trace_attributes (team_id Int32,original_expiry_time_bucket DateTime64(0),@@ -1015,39 +886,6 @@ CREATE TABLE posthog.trace_spans_kafka_metrics (max_created_at SimpleAggregateFunction(max, DateTime64(9)),max_lag SimpleAggregateFunction(max, UInt64)) ENGINE = ReplicatedMergeTree('/clickhouse/tables/logs/{shard}/posthog.trace_spans_kafka_metrics', '{replica}') ORDER BY (_topic, _partition) SETTINGS index_granularity = 8192;-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -1387,40 +1225,6 @@ FROM)GROUP BYteam_id, time_bucket, service_name, namespace, environment, severity_text;-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-us/ops.sql b/posthog/clickhouse/hcl/sql/prod-us/ops.sqlindex 60d3880d875f..d686eaca9697 100644--- a/posthog/clickhouse/hcl/sql/prod-us/ops.sql+++ b/posthog/clickhouse/hcl/sql/prod-us/ops.sql@@ -168,105 +168,6 @@ CREATE TABLE posthog.query_team_daily_stats (query_kind_counts Map(String, UInt64) COMMENT 'query_kind -> count for QueryFinish rows.',computed_at DateTime) ENGINE = ReplicatedMergeTree('/clickhouse/ops/tables/{shard}/posthog.query_team_daily_stats', '{replica}') ORDER BY (analysis_date, team_id) PARTITION BY analysis_date TTL analysis_date + toIntervalDay(90) SETTINGS index_granularity = 8192;-CREATE TABLE posthog.sharded_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64),- exception_name String ALIAS errorCodeToName(exception_code),- ProfileEvents_RealTimeMicroseconds Int64 ALIAS ProfileEvents['RealTimeMicroseconds'],- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64 ALIAS ProfileEvents['OSCPUVirtualTimeMicroseconds'],- ProfileEvents_S3Clients Int64 ALIAS ProfileEvents['S3Clients'],- ProfileEvents_S3DeleteObjects Int64 ALIAS ProfileEvents['S3DeleteObjects'],- ProfileEvents_S3CopyObject Int64 ALIAS ProfileEvents['S3CopyObject'],- ProfileEvents_S3ListObjects Int64 ALIAS ProfileEvents['S3ListObjects'],- ProfileEvents_S3HeadObject Int64 ALIAS ProfileEvents['S3HeadObject'],- ProfileEvents_S3GetObjectAttributes Int64 ALIAS ProfileEvents['S3GetObjectAttributes'],- ProfileEvents_S3CreateMultipartUpload Int64 ALIAS ProfileEvents['S3CreateMultipartUpload'],- ProfileEvents_S3UploadPartCopy Int64 ALIAS ProfileEvents['S3UploadPartCopy'],- ProfileEvents_S3UploadPart Int64 ALIAS ProfileEvents['S3UploadPart'],- ProfileEvents_S3AbortMultipartUpload Int64 ALIAS ProfileEvents['S3AbortMultipartUpload'],- ProfileEvents_S3CompleteMultipartUpload Int64 ALIAS ProfileEvents['S3CompleteMultipartUpload'],- ProfileEvents_S3PutObject Int64 ALIAS ProfileEvents['S3PutObject'],- ProfileEvents_S3GetObject Int64 ALIAS ProfileEvents['S3GetObject'],- ProfileEvents_ReadBufferFromS3Bytes Int64 ALIAS ProfileEvents['ReadBufferFromS3Bytes'],- ProfileEvents_WriteBufferFromS3Bytes Int64 ALIAS ProfileEvents['WriteBufferFromS3Bytes'],- lc_workflow LowCardinality(String) ALIAS log_comment.workflow,- lc_kind LowCardinality(String) ALIAS log_comment.kind,- lc_id String ALIAS CAST(log_comment.id, 'String'),- lc_route_id String ALIAS CAST(log_comment.route_id, 'String'),- lc_access_method LowCardinality(String) ALIAS log_comment.access_method,- lc_api_key_label String ALIAS CAST(log_comment.api_key_label, 'String'),- lc_api_key_mask String ALIAS CAST(log_comment.api_key_mask, 'String'),- lc_query_type LowCardinality(String) ALIAS log_comment.query_type,- lc_product LowCardinality(String) ALIAS log_comment.product,- lc_chargeable Bool ALIAS log_comment.chargeable,- lc_name String ALIAS CAST(log_comment.name, 'String'),- lc_request_name String ALIAS CAST(log_comment.request_name, 'String'),- lc_client_query_id String ALIAS CAST(log_comment.client_query_id, 'String'),- lc_org_id String ALIAS CAST(log_comment.org_id, 'String'),- lc_user_id Int64 ALIAS log_comment.user_id,- lc_is_impersonated Bool ALIAS log_comment.is_impersonated,- lc_session_id String ALIAS CAST(log_comment.session_id, 'String'),- lc_dashboard_id Int64 ALIAS log_comment.dashboard_id,- lc_insight_id Int64 ALIAS log_comment.insight_id,- lc_cohort_id Int64 ALIAS log_comment.cohort_id,- lc_batch_export_id String ALIAS CAST(log_comment.batch_export_id, 'String'),- lc_experiment_id Int64 ALIAS log_comment.experiment_id,- lc_experiment_feature_flag_key String ALIAS CAST(log_comment.experiment_feature_flag_key, 'String'),- lc_alert_config_id String ALIAS CAST(log_comment.alert_config_id, 'String'),- lc_feature LowCardinality(String) ALIAS log_comment.feature,- lc_table_id String ALIAS CAST(log_comment.table_id, 'String'),- lc_warehouse_query Bool ALIAS log_comment.warehouse_query,- lc_person_on_events_mode LowCardinality(String) ALIAS log_comment.person_on_events_mode,- lc_service_name String ALIAS CAST(log_comment.service_name, 'String'),- lc_workload LowCardinality(String) ALIAS log_comment.workload,- lc_query__kind LowCardinality(String) ALIAS if(JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'kind'), JSONExtractString(toString(log_comment), 'query', 'kind')),- lc_query__query String ALIAS multiIf(NOT is_initial_query, '', JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'), JSONExtractString(toString(log_comment), 'query', 'query')),- lc_query String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), ''),- lc_temporal__workflow_namespace String ALIAS CAST(log_comment.`temporal.workflow_namespace`, 'String'),- lc_temporal__workflow_type String ALIAS CAST(log_comment.`temporal.workflow_type`, 'String'),- lc_temporal__workflow_id String ALIAS CAST(log_comment.`temporal.workflow_id`, 'String'),- lc_temporal__workflow_run_id String ALIAS CAST(log_comment.`temporal.workflow_run_id`, 'String'),- lc_temporal__activity_type String ALIAS CAST(log_comment.`temporal.activity_type`, 'String'),- lc_temporal__activity_id String ALIAS CAST(log_comment.`temporal.activity_id`, 'String'),- lc_temporal__attempt Int64 ALIAS log_comment.`temporal.attempt`,- lc_dagster__job_name String ALIAS CAST(log_comment.`dagster.job_name`, 'String'),- lc_dagster__run_id String ALIAS CAST(log_comment.`dagster.run_id`, 'String'),- lc_dagster__owner String ALIAS CAST(log_comment.`dagster.tags.owner`, 'String'),- lc_modifiers String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), ''),- lc_plan_fingerprint String ALIAS ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), ''),- lc_estimated_rows Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0),- lc_estimated_bytes Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0),- ProfileEvents2 JSON(max_dynamic_paths=0, OSCPUVirtualTimeMicroseconds UInt64, ReadBufferFromS3Bytes UInt64, RealTimeMicroseconds UInt64, S3AbortMultipartUpload UInt64, S3Clients UInt64, S3CompleteMultipartUpload UInt64, S3CopyObject UInt64, S3CreateMultipartUpload UInt64, S3DeleteObjects UInt64, S3GetObject UInt64, S3GetObjectAttributes UInt64, S3HeadObject UInt64, S3ListObjects UInt64, S3PutObject UInt64, S3UploadPart UInt64, S3UploadPartCopy UInt64, WriteBufferFromS3Bytes UInt64)-) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.sharded_query_log_archive', '{replica}-{shard}') ORDER BY (team_id, event_date, event_time, query_id) PARTITION BY toYYYYMM(event_date) SETTINGS index_granularity = 8192, object_serialization_version = 'v3', object_shared_data_serialization_version = 'map_with_buckets', storage_policy = 's3_tiered';CREATE TABLE posthog.sharded_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -649,168 +550,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_buffer (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Buffer('posthog', 'sharded_query_log_archive', 16, 10, 60, 10000, 1000000, 10000000, 100000000);-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.query_log_archive_v3_buffer (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -929,39 +668,6 @@ CREATE TABLE posthog.query_log_archive_v3_buffer (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Buffer('posthog', 'sharded_query_log_archive_v3', 16, 10, 60, 10000, 1000000, 10000000, 100000000);-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -1080,40 +786,6 @@ CREATE TABLE posthog.writable_query_log_archive_v3 (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_v3_buffer');-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/hcl/sql/prod-us/sessions.sql b/posthog/clickhouse/hcl/sql/prod-us/sessions.sqlindex f83c97264915..59c8f4370c4a 100644--- a/posthog/clickhouse/hcl/sql/prod-us/sessions.sql+++ b/posthog/clickhouse/hcl/sql/prod-us/sessions.sql@@ -230,135 +230,6 @@ CREATE TABLE posthog.query_log_archive (exception_name String,ProfileEvents Map(String, UInt64)) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');-CREATE TABLE posthog.query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'sharded_query_log_archive_v3');CREATE TABLE posthog.raw_sessions (team_id Int64,session_id_v7 UInt128,@@ -532,39 +403,6 @@ CREATE TABLE posthog.writable_events_recent (_timestamp DateTime,_offset UInt64) ENGINE = Distributed('posthog_writable', 'posthog', 'sharded_events_recent', sipHash64(distinct_id));-CREATE TABLE posthog.writable_query_log_archive (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4),- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),- exception_code Int32,- exception String,- stack_trace String,- team_id Int64,- log_comment JSON(max_dynamic_paths=256, access_method LowCardinality(String), alert_config_id String, api_key_label String, api_key_mask String, batch_export_id String, chargeable Bool, client_query_id String, cohort_id Int64, `dagster.job_name` String, `dagster.run_id` String, `dagster.tags.owner` String, dashboard_id Int64, experiment_feature_flag_key String, experiment_id Int64, feature LowCardinality(String), id String, insight_id Int64, is_impersonated Bool, kind LowCardinality(String), name String, org_id String, person_on_events_mode LowCardinality(String), product LowCardinality(String), query_type LowCardinality(String), request_name String, route_id String, service_name String, session_id String, table_id String, team_id Int64, `temporal.activity_id` String, `temporal.activity_type` String, `temporal.attempt` Int64, `temporal.workflow_id` String, `temporal.workflow_namespace` String, `temporal.workflow_run_id` String, `temporal.workflow_type` String, user_id Int64, warehouse_query Bool, workflow LowCardinality(String), workload LowCardinality(String), SKIP cache_key, SKIP filter, SKIP hogql_features, SKIP http_referer, SKIP http_request_id, SKIP http_user_agent, SKIP query_settings, SKIP timings, SKIP user_email),- ProfileEvents Map(String, UInt64)-) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_buffer');CREATE TABLE posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'),team_id Int64,@@ -683,40 +521,6 @@ CREATE TABLE posthog.writable_query_log_archive_v3 (lc_estimated_rows SimpleAggregateFunction(max, Int64),lc_estimated_bytes SimpleAggregateFunction(max, Int64)) ENGINE = Distributed('ops', 'posthog', 'query_log_archive_v3_buffer');-CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_mv TO posthog.writable_query_log_archive (hostname LowCardinality(String), user LowCardinality(String), query_id String, initial_query_id String, is_initial_query UInt8, type Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4), event_date Date, event_time DateTime, event_time_microseconds DateTime64(6), query_start_time DateTime, query_start_time_microseconds DateTime64(6), query_duration_ms UInt64, read_rows UInt64, read_bytes UInt64, written_rows UInt64, written_bytes UInt64, result_rows UInt64, result_bytes UInt64, memory_usage UInt64, peak_threads_usage UInt64, current_database LowCardinality(String), query String, formatted_query String, normalized_query_hash UInt64, query_kind LowCardinality(String), exception_code Int32, exception String, stack_trace String, team_id Int64, log_comment String, ProfileEvents Map(LowCardinality(String), UInt64)) AS SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,- exception_code,- exception,- stack_trace,- JSONExtractInt(log_comment, 'team_id') AS team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE type != 'QueryStart';CREATE MATERIALIZED VIEW posthog.ops_query_log_archive_v3_mv TO posthog.writable_query_log_archive_v3 (initial_query_start_time DateTime64(6, 'UTC'), team_id Int64, initial_query_id String, is_initial_query SimpleAggregateFunction(max, UInt8), hostname SimpleAggregateFunction(max, LowCardinality(String)), user SimpleAggregateFunction(max, LowCardinality(String)), type SimpleAggregateFunction(max, Enum8('QueryStart'=1, 'QueryFinish'=2, 'ExceptionBeforeStart'=3, 'ExceptionWhileProcessing'=4)), event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')), query_duration_ms SimpleAggregateFunction(max, UInt64), read_rows SimpleAggregateFunction(sum, UInt64), read_bytes SimpleAggregateFunction(sum, UInt64), written_rows SimpleAggregateFunction(sum, UInt64), written_bytes SimpleAggregateFunction(sum, UInt64), result_rows SimpleAggregateFunction(sum, UInt64), result_bytes SimpleAggregateFunction(sum, UInt64), memory_usage SimpleAggregateFunction(max, UInt64), memory_usage_sum SimpleAggregateFunction(sum, UInt64), peak_threads_usage SimpleAggregateFunction(sum, UInt64), execution_count SimpleAggregateFunction(sum, UInt64), current_database SimpleAggregateFunction(max, LowCardinality(String)), query SimpleAggregateFunction(max, String), normalized_query_hash SimpleAggregateFunction(max, UInt64), query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)), tables SimpleAggregateFunction(max, Array(String)), exception_code SimpleAggregateFunction(max, Int32), exception SimpleAggregateFunction(max, String), stack_trace SimpleAggregateFunction(max, String), ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64), ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64), ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64), lc_org_id SimpleAggregateFunction(max, String), lc_user_id SimpleAggregateFunction(max, Int64), lc_session_id SimpleAggregateFunction(max, String), lc_is_impersonated SimpleAggregateFunction(max, Bool), lc_workflow SimpleAggregateFunction(max, LowCardinality(String)), lc_kind SimpleAggregateFunction(max, LowCardinality(String)), lc_id SimpleAggregateFunction(max, String), lc_route_id SimpleAggregateFunction(max, String), lc_access_method SimpleAggregateFunction(max, LowCardinality(String)), lc_api_key_label SimpleAggregateFunction(max, String), lc_api_key_mask SimpleAggregateFunction(max, String), lc_query_type SimpleAggregateFunction(max, LowCardinality(String)), lc_product SimpleAggregateFunction(max, LowCardinality(String)), lc_chargeable SimpleAggregateFunction(max, Bool), lc_name SimpleAggregateFunction(max, String), lc_request_name SimpleAggregateFunction(max, String), lc_client_query_id SimpleAggregateFunction(max, String), lc_dashboard_id SimpleAggregateFunction(max, Int64), lc_insight_id SimpleAggregateFunction(max, Int64), lc_cohort_id SimpleAggregateFunction(max, Int64), lc_batch_export_id SimpleAggregateFunction(max, String), lc_experiment_id SimpleAggregateFunction(max, Int64), lc_experiment_feature_flag_key SimpleAggregateFunction(max, String), lc_alert_config_id SimpleAggregateFunction(max, String), lc_feature SimpleAggregateFunction(max, LowCardinality(String)), lc_table_id SimpleAggregateFunction(max, String), lc_warehouse_query SimpleAggregateFunction(max, Bool), lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)), lc_service_name SimpleAggregateFunction(max, LowCardinality(String)), lc_workload SimpleAggregateFunction(max, LowCardinality(String)), lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)), lc_query__query SimpleAggregateFunction(max, String), lc_query SimpleAggregateFunction(max, String), lc_modifiers SimpleAggregateFunction(max, String), lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__workflow_id SimpleAggregateFunction(max, String), lc_temporal__workflow_run_id SimpleAggregateFunction(max, String), lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)), lc_temporal__activity_id SimpleAggregateFunction(max, String), lc_temporal__attempt SimpleAggregateFunction(max, Int64), lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)), lc_dagster__run_id SimpleAggregateFunction(max, String), lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_name SimpleAggregateFunction(max, String), lc_experiment_metric_name SimpleAggregateFunction(max, String), lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_precompute_table SimpleAggregateFunction(max, String), lc_experiment_query_group_id SimpleAggregateFunction(max, String), lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)), lc_experiment_scan_date_from SimpleAggregateFunction(max, String), lc_experiment_scan_date_to SimpleAggregateFunction(max, String), lc_precompute_window_start SimpleAggregateFunction(max, String), lc_precompute_window_end SimpleAggregateFunction(max, String), lc_plan_fingerprint SimpleAggregateFunction(max, String), lc_estimated_rows SimpleAggregateFunction(max, Int64), lc_estimated_bytes SimpleAggregateFunction(max, Int64)) AS WITHJSONExtract(ql.log_comment, 'Tuple(team_id Int64, org_id String, user_id Int64, session_id String, is_impersonated Bool, workflow String, kind String, id String, route_id String, access_method String, api_key_label String, api_key_mask String, query_type String, product String, chargeable Bool, name String, request_name String, client_query_id String, dashboard_id Int64, insight_id Int64, cohort_id Int64, batch_export_id String, experiment_id Int64, experiment_feature_flag_key String, alert_config_id String, feature String, table_id String, warehouse_query Bool, person_on_events_mode String, service_name String, workload String, experiment_name String, experiment_metric_name String, experiment_execution_path String, experiment_metric_type String, experiment_funnel_order_type String, experiment_exposures_path String, experiment_metric_events_path String, experiment_query_surface String, experiment_precompute_table String, experiment_query_group_id String, experiment_precompute_skip_reason String, experiment_scan_date_from String, experiment_scan_date_to String, precompute_window_start String, precompute_window_end String, plan_fingerprint String, estimated_rows Int64, estimated_bytes Int64, temporal Tuple(workflow_namespace String, workflow_type String, workflow_id String, workflow_run_id String, activity_type String, activity_id String, attempt Int64), dagster Tuple(job_name String, run_id String, tags Tuple(owner String)), query Tuple(kind String, query String, source Tuple(kind String, query String)))') AS lcSELECTdiff --git a/posthog/clickhouse/migrations/0123_create_query_log_archive.py b/posthog/clickhouse/migrations/0123_create_query_log_archive.pydeleted file mode 100644index 1a3c6f09846a..000000000000--- a/posthog/clickhouse/migrations/0123_create_query_log_archive.py+++ /dev/null@@ -1,3 +0,0 @@-from typing import Any--operations: list[Any] = []diff --git a/posthog/clickhouse/migrations/0124_extend_query_log_archive.py b/posthog/clickhouse/migrations/0124_extend_query_log_archive.pydeleted file mode 100644index 1a3c6f09846a..000000000000--- a/posthog/clickhouse/migrations/0124_extend_query_log_archive.py+++ /dev/null@@ -1,3 +0,0 @@-from typing import Any--operations: list[Any] = []diff --git a/posthog/clickhouse/migrations/0131_add_team_id_alias_to_query_log_archive.py b/posthog/clickhouse/migrations/0131_add_team_id_alias_to_query_log_archive.pydeleted file mode 100644index 1a3c6f09846a..000000000000--- a/posthog/clickhouse/migrations/0131_add_team_id_alias_to_query_log_archive.py+++ /dev/null@@ -1,3 +0,0 @@-from typing import Any--operations: list[Any] = []diff --git a/posthog/clickhouse/migrations/0132_add_team_id_to_query_log_archive_ordering_key.py b/posthog/clickhouse/migrations/0132_add_team_id_to_query_log_archive_ordering_key.pydeleted file mode 100644index 1a3c6f09846a..000000000000--- a/posthog/clickhouse/migrations/0132_add_team_id_to_query_log_archive_ordering_key.py+++ /dev/null@@ -1,3 +0,0 @@-from typing import Any--operations: list[Any] = []diff --git a/posthog/clickhouse/migrations/0134_recreate_query_log_archive_mv.py b/posthog/clickhouse/migrations/0134_recreate_query_log_archive_mv.pydeleted file mode 100644index 10bcd1f597dd..000000000000--- a/posthog/clickhouse/migrations/0134_recreate_query_log_archive_mv.py+++ /dev/null@@ -1,22 +0,0 @@-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 (- QUERY_LOG_ARCHIVE_DATA_TABLE,- QUERY_LOG_ARCHIVE_MV,- QUERY_LOG_ARCHIVE_NEW_MV_SQL,- QUERY_LOG_ARCHIVE_NEW_TABLE_SQL,- QUERY_LOG_ARCHIVE_TABLE_ENGINE_NEW,-)--operations = [- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_NEW_TABLE_SQL(- table_name=QUERY_LOG_ARCHIVE_DATA_TABLE, engine=QUERY_LOG_ARCHIVE_TABLE_ENGINE_NEW()- ),- node_roles=[NodeRole.DATA],- ),- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_NEW_MV_SQL(view_name=QUERY_LOG_ARCHIVE_MV, dest_table=QUERY_LOG_ARCHIVE_DATA_TABLE),- node_roles=[NodeRole.DATA],- ),-]diff --git a/posthog/clickhouse/migrations/0135_api_key_mask_in_query_log.py b/posthog/clickhouse/migrations/0135_api_key_mask_in_query_log.pydeleted file mode 100644index 1a3c6f09846a..000000000000--- a/posthog/clickhouse/migrations/0135_api_key_mask_in_query_log.py+++ /dev/null@@ -1,3 +0,0 @@-from typing import Any--operations: list[Any] = []diff --git a/posthog/clickhouse/migrations/0142_query_log_request_name.py b/posthog/clickhouse/migrations/0142_query_log_request_name.pydeleted file mode 100644index 5124fe857351..000000000000--- a/posthog/clickhouse/migrations/0142_query_log_request_name.py+++ /dev/null@@ -1,15 +0,0 @@-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 ADD_LC_REQUEST_NAME_SQL, QUERY_LOG_ARCHIVE_MV_V4_SQL--operations = [- run_sql_with_exceptions(- ADD_LC_REQUEST_NAME_SQL,- node_roles=[NodeRole.DATA],- is_alter_on_replicated_table=True,- ),- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_MV_V4_SQL(),- node_roles=[NodeRole.DATA],- ),-]diff --git a/posthog/clickhouse/migrations/0150_query_log_exception_name.py b/posthog/clickhouse/migrations/0150_query_log_exception_name.pydeleted file mode 100644index 829a3f8ad5a7..000000000000--- a/posthog/clickhouse/migrations/0150_query_log_exception_name.py+++ /dev/null@@ -1,12 +0,0 @@-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 ADD_EXCEPTION_NAME_SQL--operations = [- run_sql_with_exceptions(- ADD_EXCEPTION_NAME_SQL,- node_roles=[NodeRole.DATA],- sharded=False,- is_alter_on_replicated_table=True,- ),-]diff --git a/posthog/clickhouse/migrations/0181_endpoints_cluster_query_log.py b/posthog/clickhouse/migrations/0181_endpoints_cluster_query_log.pydeleted file mode 100644index 530e7162451a..000000000000--- a/posthog/clickhouse/migrations/0181_endpoints_cluster_query_log.py+++ /dev/null@@ -1,20 +0,0 @@-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 (- QUERY_LOG_ARCHIVE_CROSS_CLUSTER_DISTRIBUTED_TABLE_SQL,- QUERY_LOG_ARCHIVE_NEW_MV_SQL,- QUERY_LOG_ARCHIVE_WRITABLE_DISTRIBUTED_TABLE,-)--operations = [- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_CROSS_CLUSTER_DISTRIBUTED_TABLE_SQL(),- node_roles=NodeRole.ENDPOINTS,- ),- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_NEW_MV_SQL(- view_name="query_log_archive_mv", dest_table=QUERY_LOG_ARCHIVE_WRITABLE_DISTRIBUTED_TABLE- ),- node_roles=NodeRole.ENDPOINTS,- ),-]diff --git a/posthog/clickhouse/migrations/0182_endpoints_cluster_query_log_prod.py b/posthog/clickhouse/migrations/0182_endpoints_cluster_query_log_prod.pydeleted file mode 100644index 530e7162451a..000000000000--- a/posthog/clickhouse/migrations/0182_endpoints_cluster_query_log_prod.py+++ /dev/null@@ -1,20 +0,0 @@-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 (- QUERY_LOG_ARCHIVE_CROSS_CLUSTER_DISTRIBUTED_TABLE_SQL,- QUERY_LOG_ARCHIVE_NEW_MV_SQL,- QUERY_LOG_ARCHIVE_WRITABLE_DISTRIBUTED_TABLE,-)--operations = [- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_CROSS_CLUSTER_DISTRIBUTED_TABLE_SQL(),- node_roles=NodeRole.ENDPOINTS,- ),- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_NEW_MV_SQL(- view_name="query_log_archive_mv", dest_table=QUERY_LOG_ARCHIVE_WRITABLE_DISTRIBUTED_TABLE- ),- node_roles=NodeRole.ENDPOINTS,- ),-]diff --git a/posthog/clickhouse/migrations/0193_add_lc_is_impersonated_to_query_log_archive.py b/posthog/clickhouse/migrations/0193_add_lc_is_impersonated_to_query_log_archive.pydeleted file mode 100644index 978f062c175b..000000000000--- a/posthog/clickhouse/migrations/0193_add_lc_is_impersonated_to_query_log_archive.py+++ /dev/null@@ -1,30 +0,0 @@-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 (- QUERY_LOG_ARCHIVE_ADD_IS_IMPERSONATED_SQL,- QUERY_LOG_ARCHIVE_MV_V4_SQL,- QUERY_LOG_ARCHIVE_WRITABLE_DISTRIBUTED_TABLE,-)--operations = [- # Add the lc_is_impersonated column to the tables- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_IS_IMPERSONATED_SQL(),- node_roles=[NodeRole.DATA],- is_alter_on_replicated_table=True,- sharded=False,- ),- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_IS_IMPERSONATED_SQL(QUERY_LOG_ARCHIVE_WRITABLE_DISTRIBUTED_TABLE),- node_roles=[NodeRole.ENDPOINTS],- is_alter_on_replicated_table=False,- sharded=False,- ),- # Update the MV to extract is_impersonated from log_comment- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_MV_V4_SQL(),- node_roles=[NodeRole.DATA, NodeRole.ENDPOINTS],- is_alter_on_replicated_table=False,- sharded=False,- ),-]diff --git a/posthog/clickhouse/migrations/0196_shard_query_log_archive.py b/posthog/clickhouse/migrations/0196_shard_query_log_archive.pydeleted file mode 100644index 71d159dc8af6..000000000000--- a/posthog/clickhouse/migrations/0196_shard_query_log_archive.py+++ /dev/null@@ -1,67 +0,0 @@-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 (- DIST_QUERY_LOG_ARCHIVE_MV,- DISTRIBUTED_QUERY_LOG_ARCHIVE_TABLE_SQL,- QUERY_LOG_ARCHIVE_DATA_TABLE,- QUERY_LOG_ARCHIVE_MV,- QUERY_LOG_ARCHIVE_NEW_MV_SQL,- QUERY_LOG_ARCHIVE_OLD_TABLE,- QUERY_LOG_ARCHIVE_WRITABLE_DISTRIBUTED_TABLE,- SHARDED_QUERY_LOG_ARCHIVE_MV,- SHARDED_QUERY_LOG_ARCHIVE_TABLE,- SHARDED_QUERY_LOG_ARCHIVE_TABLE_SQL,- SHARDED_QUERY_LOG_ARCHIVE_WRITABLE_TABLE,- SHARDED_WRITABLE_QUERY_LOG_ARCHIVE_TABLE_SQL,-)--operations = [- # create sharded data table- run_sql_with_exceptions(- SHARDED_QUERY_LOG_ARCHIVE_TABLE_SQL(),- node_roles=[NodeRole.DATA],- ),- # start writing query log to it on workers- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_NEW_MV_SQL(- view_name=SHARDED_QUERY_LOG_ARCHIVE_MV,- dest_table=SHARDED_QUERY_LOG_ARCHIVE_TABLE,- ),- node_roles=[NodeRole.DATA],- ),- # and add writable view, so other nodes can write to it- run_sql_with_exceptions(- SHARDED_WRITABLE_QUERY_LOG_ARCHIVE_TABLE_SQL(),- node_roles=[NodeRole.ENDPOINTS],- ),- # This is tricky part, the worker nodes, writes to own replica of sharded_query_log_archive.- # This limits the parts flying in the cluster. Endpoints nodes do not have own query_log_archive table,- # therefor need to write to distributed one. This will need to be carried through all query_log_archive updates!- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_NEW_MV_SQL(- view_name=DIST_QUERY_LOG_ARCHIVE_MV,- dest_table=SHARDED_QUERY_LOG_ARCHIVE_WRITABLE_TABLE,- ),- node_roles=[NodeRole.ENDPOINTS],- ),- # Drop old MV- run_sql_with_exceptions(- f"DROP TABLE IF EXISTS {QUERY_LOG_ARCHIVE_MV}",- node_roles=[NodeRole.DATA, NodeRole.ENDPOINTS],- ),- # and drop old distributed table for endpoints- run_sql_with_exceptions(- f"DROP TABLE IF EXISTS {QUERY_LOG_ARCHIVE_WRITABLE_DISTRIBUTED_TABLE}",- node_roles=[NodeRole.ENDPOINTS],- ),- # rename old table, so it can be taken care later- run_sql_with_exceptions(- f"RENAME TABLE {QUERY_LOG_ARCHIVE_DATA_TABLE} TO {QUERY_LOG_ARCHIVE_OLD_TABLE}",- node_roles=[NodeRole.DATA],- ),- # and create a new distributed so we can query it without interruptions- run_sql_with_exceptions(- DISTRIBUTED_QUERY_LOG_ARCHIVE_TABLE_SQL(),- node_roles=[NodeRole.DATA],- ),-]diff --git a/posthog/clickhouse/migrations/0199_query_log_archive_initial_query.py b/posthog/clickhouse/migrations/0199_query_log_archive_initial_query.pydeleted file mode 100644index be61f737783e..000000000000--- a/posthog/clickhouse/migrations/0199_query_log_archive_initial_query.py+++ /dev/null@@ -1,54 +0,0 @@-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 (- DIST_QUERY_LOG_ARCHIVE_MV,- MV_SELECT_SQL,- QUERY_LOG_ARCHIVE_ADD_V8_COLUMNS_SQL,- QUERY_LOG_ARCHIVE_DATA_TABLE,- SHARDED_QUERY_LOG_ARCHIVE_MV,- SHARDED_QUERY_LOG_ARCHIVE_TABLE,- SHARDED_QUERY_LOG_ARCHIVE_WRITABLE_TABLE,- SHARDED_WRITABLE_QUERY_LOG_ARCHIVE_TABLE_SQL,-)--operations = [- # Add columns to the sharded data table- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_V8_COLUMNS_SQL(SHARDED_QUERY_LOG_ARCHIVE_TABLE),- node_roles=[NodeRole.DATA],- sharded=True,- is_alter_on_replicated_table=True,- ),- run_sql_with_exceptions(- SHARDED_WRITABLE_QUERY_LOG_ARCHIVE_TABLE_SQL(),- node_roles=[NodeRole.ENDPOINTS],- ),- # Add columns to the writable distributed table- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_V8_COLUMNS_SQL(SHARDED_QUERY_LOG_ARCHIVE_WRITABLE_TABLE),- node_roles=[NodeRole.ENDPOINTS],- sharded=False,- is_alter_on_replicated_table=False,- ),- # Add columns to the distributed read table- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_V8_COLUMNS_SQL(QUERY_LOG_ARCHIVE_DATA_TABLE),- node_roles=[NodeRole.DATA],- sharded=False,- is_alter_on_replicated_table=False,- ),- # Update the MV on data nodes- run_sql_with_exceptions(- f"ALTER TABLE {SHARDED_QUERY_LOG_ARCHIVE_MV} MODIFY QUERY\n{MV_SELECT_SQL}",- node_roles=[NodeRole.DATA],- sharded=False,- is_alter_on_replicated_table=False,- ),- # Update the MV on endpoints nodes- run_sql_with_exceptions(- f"ALTER TABLE {DIST_QUERY_LOG_ARCHIVE_MV} MODIFY QUERY\n{MV_SELECT_SQL}",- node_roles=[NodeRole.ENDPOINTS],- sharded=False,- is_alter_on_replicated_table=False,- ),-]diff --git a/posthog/clickhouse/migrations/0204_add_lc_query_to_query_log_archive.py b/posthog/clickhouse/migrations/0204_add_lc_query_to_query_log_archive.pydeleted file mode 100644index bcb580f34d99..000000000000--- a/posthog/clickhouse/migrations/0204_add_lc_query_to_query_log_archive.py+++ /dev/null@@ -1,49 +0,0 @@-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 (- DIST_QUERY_LOG_ARCHIVE_MV,- QUERY_LOG_ARCHIVE_ADD_LC_QUERY_SQL,- QUERY_LOG_ARCHIVE_DATA_TABLE,- QUERY_LOG_ARCHIVE_UPDATE_MV_SQL,- SHARDED_QUERY_LOG_ARCHIVE_MV,- SHARDED_QUERY_LOG_ARCHIVE_TABLE,- SHARDED_QUERY_LOG_ARCHIVE_WRITABLE_TABLE,-)--operations = [- # Add lc_query column to sharded_query_log_archive table- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_LC_QUERY_SQL(SHARDED_QUERY_LOG_ARCHIVE_TABLE),- node_roles=[NodeRole.DATA],- sharded=True,- is_alter_on_replicated_table=True,- ),- # Add lc_query column to writable_sharded_query_log_archive distributed table- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_LC_QUERY_SQL(SHARDED_QUERY_LOG_ARCHIVE_WRITABLE_TABLE),- node_roles=[NodeRole.ENDPOINTS],- is_alter_on_replicated_table=False,- sharded=False,- ),- # Add lc_query column to query_log_archive distributed table- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_LC_QUERY_SQL(QUERY_LOG_ARCHIVE_DATA_TABLE),- node_roles=[NodeRole.DATA],- is_alter_on_replicated_table=False,- sharded=False,- ),- # Update sharded_query_log_archive_mv on DATA nodes- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_UPDATE_MV_SQL(SHARDED_QUERY_LOG_ARCHIVE_MV),- node_roles=[NodeRole.DATA],- is_alter_on_replicated_table=False,- sharded=False,- ),- # Update dist_query_log_archive_mv on ENDPOINTS- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_UPDATE_MV_SQL(DIST_QUERY_LOG_ARCHIVE_MV),- node_roles=[NodeRole.ENDPOINTS],- is_alter_on_replicated_table=False,- sharded=False,- ),-]diff --git a/posthog/clickhouse/migrations/0208_query_log_archive_modifiers.py b/posthog/clickhouse/migrations/0208_query_log_archive_modifiers.pydeleted file mode 100644index a97c5f6b92a1..000000000000--- a/posthog/clickhouse/migrations/0208_query_log_archive_modifiers.py+++ /dev/null@@ -1,55 +0,0 @@-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 (- DIST_QUERY_LOG_ARCHIVE_MV,- MV_SELECT_SQL,- QUERY_LOG_ARCHIVE_ADD_MODIFIERS_COLUMN_SQL,- QUERY_LOG_ARCHIVE_DATA_TABLE,- SHARDED_QUERY_LOG_ARCHIVE_MV,- SHARDED_QUERY_LOG_ARCHIVE_TABLE,- SHARDED_QUERY_LOG_ARCHIVE_WRITABLE_TABLE,- SHARDED_WRITABLE_QUERY_LOG_ARCHIVE_TABLE_SQL,-)--operations = [- # Add column to the sharded data table- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_MODIFIERS_COLUMN_SQL(SHARDED_QUERY_LOG_ARCHIVE_TABLE),- node_roles=[NodeRole.DATA],- sharded=True,- is_alter_on_replicated_table=True,- ),- # Recreate writable distributed table (creates with new schema if not exists)- run_sql_with_exceptions(- SHARDED_WRITABLE_QUERY_LOG_ARCHIVE_TABLE_SQL(),- node_roles=[NodeRole.ENDPOINTS],- ),- # Add column to the writable distributed table (if it already existed)- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_MODIFIERS_COLUMN_SQL(SHARDED_QUERY_LOG_ARCHIVE_WRITABLE_TABLE),- node_roles=[NodeRole.ENDPOINTS],- sharded=False,- is_alter_on_replicated_table=False,- ),- # Add column to the distributed read table- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_MODIFIERS_COLUMN_SQL(QUERY_LOG_ARCHIVE_DATA_TABLE),- node_roles=[NodeRole.DATA],- sharded=False,- is_alter_on_replicated_table=False,- ),- # Update the MV on data nodes- run_sql_with_exceptions(- f"ALTER TABLE {SHARDED_QUERY_LOG_ARCHIVE_MV} MODIFY QUERY\n{MV_SELECT_SQL}",- node_roles=[NodeRole.DATA],- sharded=False,- is_alter_on_replicated_table=False,- ),- # Update the MV on endpoints nodes- run_sql_with_exceptions(- f"ALTER TABLE {DIST_QUERY_LOG_ARCHIVE_MV} MODIFY QUERY\n{MV_SELECT_SQL}",- node_roles=[NodeRole.ENDPOINTS],- sharded=False,- is_alter_on_replicated_table=False,- ),-]diff --git a/posthog/clickhouse/migrations/0273_query_log_archive_ops_json.py b/posthog/clickhouse/migrations/0273_query_log_archive_ops_json.pyindex 30a784b4c96f..ca618a18e40e 100644--- a/posthog/clickhouse/migrations/0273_query_log_archive_ops_json.py+++ b/posthog/clickhouse/migrations/0273_query_log_archive_ops_json.py@@ -2,44 +2,20 @@ from posthog.clickhouse.client.connection import NodeRolefrom posthog.clickhouse.client.migration_tools import run_sql_with_exceptionsfrom posthog.clickhouse.query_log_archive import (DISTRIBUTED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,- DISTRIBUTED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL,QUERY_LOG_ARCHIVE_DATA_TABLE,- QUERY_LOG_ARCHIVE_OPS_MV,- QUERY_LOG_ARCHIVE_OPS_MV_SQL,QUERY_LOG_ARCHIVE_V3_BUFFER_TABLE_SQL,QUERY_LOG_ARCHIVE_V3_MV_SQL,- SHARDED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,- SHARDED_QUERY_LOG_ARCHIVE_TABLE,SHARDED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL,- SHARDED_QUERY_LOG_ARCHIVE_WRITABLE_TABLE,- WRITABLE_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,- WRITABLE_QUERY_LOG_ARCHIVE_TABLE,WRITABLE_QUERY_LOG_ARCHIVE_V3_TABLE_SQL,)from posthog.run_mode import run_mode-# Rebuild query_log_archive as a JSON-backed data table living on the OPS cluster:-# - sharded_query_log_archive : OPS data table, stores log_comment as a curated JSON column and-# ProfileEvents as the raw Map; every lc_* / ProfileEvents_* column is a read-time ALIAS.-# - query_log_archive : Distributed read table over ops.sharded_query_log_archive, everywhere.-# - writable_query_log_archive: Distributed write table (physical columns only), everywhere.-# - ops_query_log_archive_mv : slim MV (system.query_log -> writable), on every cluster.-#-# The v3 generation (one aggregated row per query chain) runs beside it with the same topology:-# sharded_query_log_archive_v3 and query_log_archive_v3_buffer on OPS; writable_query_log_archive_v3,-# ops_query_log_archive_v3_mv and query_log_archive_v3 on every cluster. query_log_archive reads the-# v3 data table, not sharded_query_log_archive.-#-# This migration is idempotent and converges TWO divergent starting states:-# (A) Production, set up by hand: query_log_archive is the *data table* on OPS, writable_query_log_archive-# and ops_query_log_archive_mv already exist (old schema, all lc_*/ProfileEvents_* physical).-# (B) Repo migration history (0196+): sharded_query_log_archive is the data table, with-# sharded_query_log_archive_mv / dist_query_log_archive_mv MVs.-# The old OPS data table is renamed to query_log_archive_old (NOT dropped) so it can be backfilled into-# the new table manually; the ClickHouse team drops it afterwards.+# The query_log_archive suite on the OPS cluster, one aggregated row per query chain:+# - sharded_query_log_archive_v3 and query_log_archive_v3_buffer on OPS.+# - writable_query_log_archive_v3 and ops_query_log_archive_v3_mv on every cluster, so every cluster+# archives its own system.query_log into OPS.+# - query_log_archive, the Distributed read table over the v3 data table, everywhere.-# Every cluster produces its own system.query_log, archives it into OPS via the writable table, and can-# read it back through the Distributed query_log_archive.ALL_ROLES = [NodeRole.DATA,NodeRole.ENDPOINTS,@@ -48,66 +24,47 @@ ALL_ROLES = [NodeRole.SESSIONS,NodeRole.OPS,]-QUERY_LOG_ARCHIVE_OLD_TABLE = "query_log_archive_old" # renamed OPS data table, kept for manual backfill-SHARDED_OLD_TABLE = "sharded_query_log_archive_old" # renamed repo-history data table (state B)-# Previous-generation MV names retired here (prod uses ops_query_log_archive_mv; history uses the others).-OLD_SHARDED_MV = "sharded_query_log_archive_mv"-OLD_DIST_MV = "dist_query_log_archive_mv"+# Write path of earlier generations. A stack that ran part of the old migration chain can still have+# these objects. None of them stores data, so they are dropped. The data tables of those generations+# (sharded_query_log_archive, query_log_archive_v2) stay, and the operator decides when to drop them.+# The cloud clusters do not run this cleanup: posthog-cloud-infra owns their archive objects, and the+# v3 objects take over some of these names there.+LEGACY_VIEWS = [+ "query_log_archive_mv",+ "sharded_query_log_archive_mv",+ "dist_query_log_archive_mv",+ "ops_query_log_archive_mv",+ "daily_aggregated_query_log_archive",+]+LEGACY_WRITE_TABLES = [+ "writable_query_log_archive",+ "writable_sharded_query_log_archive",+ "query_log_archive_buffer",+]operations = [- # ---------- A. Stop the old write path (MVs hold no data) ----------- run_sql_with_exceptions(f"DROP TABLE IF EXISTS {QUERY_LOG_ARCHIVE_OPS_MV}", node_roles=ALL_ROLES),- run_sql_with_exceptions(f"DROP TABLE IF EXISTS {OLD_SHARDED_MV}", node_roles=[NodeRole.DATA]),- run_sql_with_exceptions(f"DROP TABLE IF EXISTS {OLD_DIST_MV}", node_roles=[NodeRole.ENDPOINTS]),- # ---------- B. Move the old populated data tables aside (no data dropped) ----------- # State B: the repo-history sharded data table collides with the new JSON table name.- run_sql_with_exceptions(- f"RENAME TABLE IF EXISTS {SHARDED_QUERY_LOG_ARCHIVE_TABLE} TO {SHARDED_OLD_TABLE}",- node_roles=[NodeRole.DATA],- ),- # State A: the production OPS data table. Kept as query_log_archive_old for the manual backfill.- run_sql_with_exceptions(- f"RENAME TABLE IF EXISTS {QUERY_LOG_ARCHIVE_DATA_TABLE} TO {QUERY_LOG_ARCHIVE_OLD_TABLE}",- node_roles=[NodeRole.OPS],- ),- # Only cloud has data to backfill. Off cloud the rename above is either a no-op (OPS- # carries no query_log_archive until step G creates it) or, where every role shares one- # node, it catches the DATA-side table and leaves an empty copy behind — so drop it.*([]if run_mode().is_deployed_cloudelse [- run_sql_with_exceptions(- f"DROP TABLE IF EXISTS {QUERY_LOG_ARCHIVE_OLD_TABLE}",- node_roles=[NodeRole.OPS],- ),- run_sql_with_exceptions(- f"DROP TABLE IF EXISTS {SHARDED_QUERY_LOG_ARCHIVE_WRITABLE_TABLE}",- node_roles=[NodeRole.ENDPOINTS],- ),+ # Drop the views first, so that no MV writes into a table this migration drops.+ *[run_sql_with_exceptions(f"DROP TABLE IF EXISTS {view}", node_roles=ALL_ROLES) for view in LEGACY_VIEWS],+ *[+ run_sql_with_exceptions(f"DROP TABLE IF EXISTS {table}", node_roles=ALL_ROLES)+ for table in LEGACY_WRITE_TABLES+ ],]),- # ---------- C. New JSON-backed data table on OPS ----------- run_sql_with_exceptions(SHARDED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(), node_roles=[NodeRole.OPS]),- # ---------- D. Writable Distributed (physical columns only) -> ops.sharded, on every cluster ----------- # Drop first to replace prod's existing old-schema writable (a no-data Distributed).- run_sql_with_exceptions(f"DROP TABLE IF EXISTS {WRITABLE_QUERY_LOG_ARCHIVE_TABLE}", node_roles=ALL_ROLES),- run_sql_with_exceptions(WRITABLE_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(), node_roles=ALL_ROLES),- # ---------- E. Slim MV (system.query_log -> writable), on every cluster ----------- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_OPS_MV_SQL(view_name=QUERY_LOG_ARCHIVE_OPS_MV, dest_table=WRITABLE_QUERY_LOG_ARCHIVE_TABLE),- node_roles=ALL_ROLES,- ),- # ---------- F. v3 write path: data table + Buffer on OPS, writable + MV on every cluster ----------run_sql_with_exceptions(SHARDED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL(), node_roles=[NodeRole.OPS]),run_sql_with_exceptions(QUERY_LOG_ARCHIVE_V3_BUFFER_TABLE_SQL(), node_roles=[NodeRole.OPS]),run_sql_with_exceptions(WRITABLE_QUERY_LOG_ARCHIVE_V3_TABLE_SQL(), node_roles=ALL_ROLES),run_sql_with_exceptions(QUERY_LOG_ARCHIVE_V3_MV_SQL(), node_roles=ALL_ROLES),- # ---------- G. Read Distributed tables -> ops.sharded_query_log_archive_v3, on EVERY node ----------- # Created everywhere so query_log_archive is queryable from any node. Safe to drop on every node:- # the only place it is a populated data table is OPS, already renamed aside in B.- run_sql_with_exceptions(f"DROP TABLE IF EXISTS {QUERY_LOG_ARCHIVE_DATA_TABLE}", node_roles=[NodeRole.ALL]),+ # An earlier generation used query_log_archive as a data table. Rename it aside, so that the read+ # table can take the name and no archived rows are lost.+ run_sql_with_exceptions(+ f"RENAME TABLE IF EXISTS {QUERY_LOG_ARCHIVE_DATA_TABLE} TO {QUERY_LOG_ARCHIVE_DATA_TABLE}_legacy",+ node_roles=[NodeRole.ALL],+ ),run_sql_with_exceptions(DISTRIBUTED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(), node_roles=[NodeRole.ALL]),- run_sql_with_exceptions(DISTRIBUTED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL(), node_roles=[NodeRole.ALL]),]diff --git a/posthog/clickhouse/migrations/0274_daily_aggregated_query_log_archive_view.py b/posthog/clickhouse/migrations/0274_daily_aggregated_query_log_archive_view.pydeleted file mode 100644index 4506b66ec5a5..000000000000--- a/posthog/clickhouse/migrations/0274_daily_aggregated_query_log_archive_view.py+++ /dev/null@@ -1,10 +0,0 @@-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_SQL--operations = [- run_sql_with_exceptions(- DAILY_AGGREGATED_QUERY_LOG_ARCHIVE_VIEW_SQL(),- node_roles=[NodeRole.OPS],- ),-]diff --git a/posthog/clickhouse/migrations/0276_query_log_archive_buffer.py b/posthog/clickhouse/migrations/0276_query_log_archive_buffer.pydeleted file mode 100644index 0b7fae61df71..000000000000--- a/posthog/clickhouse/migrations/0276_query_log_archive_buffer.py+++ /dev/null@@ -1,43 +0,0 @@-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 (- QUERY_LOG_ARCHIVE_BUFFER_OPS_TABLE_SQL,- WRITABLE_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,- WRITABLE_QUERY_LOG_ARCHIVE_TABLE,-)-from posthog.run_mode import run_mode--# Insert a Buffer table (query_log_archive_buffer) in front of sharded_query_log_archive on the-# OPS cluster and route writable_query_log_archive through it, so the many small per-cluster MV-# inserts are batched in memory before flushing to the ReplicatedMergeTree, reducing part churn.-#-# In the cloud, writable_query_log_archive and ops_query_log_archive_mv are config-managed by-# posthog-cloud-infra (ansible managed_schemas), which repoints the writable at the buffer. This-# migration must NOT touch those objects in the cloud or it would fight that config. So in the-# cloud it only creates the buffer (which infra does not manage); the writable repoint happens-# locally only, where posthog-cloud-infra does not run, to keep dev parity.--ALL_ROLES = [- NodeRole.DATA,- NodeRole.ENDPOINTS,- NodeRole.AUX,- NodeRole.AI_EVENTS,- NodeRole.SESSIONS,- NodeRole.OPS,-]--operations = [- # Buffer table on OPS, flushing to sharded_query_log_archive. Owned by this migration- # (not posthog-cloud-infra), so created everywhere — cloud and local.- run_sql_with_exceptions(QUERY_LOG_ARCHIVE_BUFFER_OPS_TABLE_SQL(), node_roles=[NodeRole.OPS]),- # Repoint the writable Distributed at the buffer — local only. In the cloud this is done by- # posthog-cloud-infra. Drop + recreate is safe (Distributed holds no data, not replicated).- *(- []- if run_mode().is_deployed_cloud- else [- run_sql_with_exceptions(f"DROP TABLE IF EXISTS {WRITABLE_QUERY_LOG_ARCHIVE_TABLE}", node_roles=ALL_ROLES),- run_sql_with_exceptions(WRITABLE_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(), node_roles=ALL_ROLES),- ]- ),-]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.pydeleted file mode 100644index 5afdb1198c11..000000000000--- a/posthog/clickhouse/migrations/0279_drop_daily_aggregated_query_log_archive_view.py+++ /dev/null@@ -1,10 +0,0 @@-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/0337_query_log_archive_cost_planner_aliases.py b/posthog/clickhouse/migrations/0337_query_log_archive_cost_planner_aliases.pydeleted file mode 100644index 7ef7692caff7..000000000000--- a/posthog/clickhouse/migrations/0337_query_log_archive_cost_planner_aliases.py+++ /dev/null@@ -1,30 +0,0 @@-"""AUTO-GENERATED from the declarative HCL by posthog/clickhouse/hcl/codegen/gen_migration.py.-Placement (node_roles) is derived from the node composition manifest; review before committing.-"""--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 (- QUERY_LOG_ARCHIVE_ADD_COST_PLANNER_ALIASES_SQL,- QUERY_LOG_ARCHIVE_DATA_TABLE,- SHARDED_QUERY_LOG_ARCHIVE_TABLE,-)--# Read-time ALIAS columns over log_comment paths the HogQL cost planner emits as query tags. The JSON-# column already stores those paths, so this is metadata only: no data is rewritten and the writable,-# buffer and MV are untouched because they carry physical columns only.-operations = [- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_COST_PLANNER_ALIASES_SQL(SHARDED_QUERY_LOG_ARCHIVE_TABLE),- node_roles=[NodeRole.OPS],- sharded=False,- is_alter_on_replicated_table=True,- ),- # The Distributed read table was created on every node (0273), so it converges on every node too.- run_sql_with_exceptions(- QUERY_LOG_ARCHIVE_ADD_COST_PLANNER_ALIASES_SQL(QUERY_LOG_ARCHIVE_DATA_TABLE),- node_roles=[NodeRole.ALL],- sharded=False,- is_alter_on_replicated_table=False,- ),-]diff --git a/posthog/clickhouse/query_log_archive.py b/posthog/clickhouse/query_log_archive.pyindex c6457183d999..4ed107e772fd 100644--- a/posthog/clickhouse/query_log_archive.py+++ b/posthog/clickhouse/query_log_archive.py@@ -1,859 +1,8 @@from django.conf import settings-from posthog.clickhouse.table_engines import (- AggregatingMergeTree,- Buffer,- Distributed,- MergeTreeEngine,- ReplicationScheme,-)+from posthog.clickhouse.table_engines import AggregatingMergeTree, Buffer, Distributed, ReplicationSchemeQUERY_LOG_ARCHIVE_DATA_TABLE = "query_log_archive"-QUERY_LOG_ARCHIVE_MV = "query_log_archive_mv"-QUERY_LOG_ARCHIVE_OLD_TABLE = "query_log_archive_v2"-QUERY_LOG_ARCHIVE_WRITABLE_DISTRIBUTED_TABLE = "writable_query_log_archive"--SHARDED_QUERY_LOG_ARCHIVE_TABLE = "sharded_query_log_archive"-SHARDED_QUERY_LOG_ARCHIVE_MV = "sharded_query_log_archive_mv"-DIST_QUERY_LOG_ARCHIVE_MV = "dist_query_log_archive_mv"-SHARDED_QUERY_LOG_ARCHIVE_WRITABLE_TABLE = "writable_sharded_query_log_archive"---def QUERY_LOG_ARCHIVE_TABLE_ENGINE_NEW():- return MergeTreeEngine("query_log_archive_new", replication_scheme=ReplicationScheme.REPLICATED)---CREATE_QUERY_LOG_ARCHIVE_BASE_TABLE = """-CREATE TABLE IF NOT EXISTS {table_name} (- hostname LowCardinality(String), -- comment 'Hostname of the server executing the query.',- user LowCardinality(String), -- comment 'Name of the user who initiated the current query.',- query_id String, -- comment 'ID of the query.',- type Enum8('QueryStart' = 1, 'QueryFinish' = 2, 'ExceptionBeforeStart' = 3, 'ExceptionWhileProcessing' = 4), -- comment 'Type of an event that occurred when executing the query.',-- event_date Date, -- comment 'Query starting date.',- event_time DateTime, -- comment 'Query starting time.',- event_time_microseconds DateTime64(6), -- comment 'Query starting time with microseconds precision.',- query_start_time DateTime, -- comment 'Start time of query execution.',- query_start_time_microseconds DateTime64(6), -- comment 'Start time of query execution with microsecond precision.',- query_duration_ms UInt64, -- comment 'Duration of query execution in milliseconds.',-- read_rows UInt64, -- comment 'Total number of rows read from all tables and table functions participated in query. It includes usual subqueries, subqueries for IN and JOIN. For distributed queries read_rows includes the total number of rows read at all replicas. Each replica sends it''s read_rows value, and the server-initiator of the query summarizes all received and local values. The cache volumes do not affect this value.',- read_bytes UInt64, -- comment 'Total number of bytes read from all tables and table functions participated in query. It includes usual subqueries, subqueries for IN and JOIN. For distributed queries read_bytes includes the total number of rows read at all replicas. Each replica sends it''s read_bytes value, and the server-initiator of the query summarizes all received and local values. The cache volumes do not affect this value.',- written_rows UInt64, -- comment 'For INSERT queries, the number of written rows. For other queries, the column value is 0.',- written_bytes UInt64, -- comment 'For INSERT queries, the number of written bytes (uncompressed). For other queries, the column value is 0.',- result_rows UInt64, -- comment 'Number of rows in a result of the SELECT query, or a number of rows in the INSERT query.',- result_bytes UInt64, -- comment 'RAM volume in bytes used to store a query result.',- memory_usage UInt64, -- comment 'Memory consumption by the query.',- peak_threads_usage UInt64, -- comment 'Maximum count of simultaneous threads executing the query.',-- current_database LowCardinality(String), -- comment 'Name of the current database.',- query String, -- comment ' Query string.',- formatted_query String, -- comment 'Formatted query string.',- normalized_query_hash UInt64, -- comment 'A numeric hash value, such as it is identical for queries differ only by values of literals.',- query_kind LowCardinality(String), -- comment 'Type of the query.',-- exception_code Int32, -- comment 'Code of an exception.',- exception_name String ALIAS errorCodeToName(exception_code), -- comment 'Name of an exception.',- exception String, -- comment 'Exception message.',- stack_trace String, -- comment 'Stack trace. An empty string, if the query was completed successfully.',-- -- the above columns are copied directly from system.query_log- ProfileEvents_RealTimeMicroseconds Int64, -- comment 'ProfileEvents[RealTimeMicroseconds]',- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64, -- comment 'ProfileEvents[OSCPUVirtualTimeMicroseconds]',-- -- s3 stats in query_log.ProfileEvents- ProfileEvents_S3Clients Int64, -- comment 'ProfileEvents[S3Clients]'- ProfileEvents_S3DeleteObjects Int64, -- comment 'ProfileEvents[S3DeleteObjects]'- ProfileEvents_S3CopyObject Int64, -- comment 'ProfileEvents[S3CopyObject]'- ProfileEvents_S3ListObjects Int64, -- comment 'ProfileEvents[S3ListObjects]'- ProfileEvents_S3HeadObject Int64, -- comment 'ProfileEvents[S3HeadObject]'- ProfileEvents_S3GetObjectAttributes Int64, -- comment 'ProfileEvents[S3GetObjectAttributes]'- ProfileEvents_S3CreateMultipartUpload Int64, -- comment 'ProfileEvents[S3CreateMultipartUpload]'- ProfileEvents_S3UploadPartCopy Int64, -- comment 'ProfileEvents[S3UploadPartCopy]'- ProfileEvents_S3UploadPart Int64, -- comment 'ProfileEvents[S3UploadPart]'- ProfileEvents_S3AbortMultipartUpload Int64, -- comment 'ProfileEvents[S3AbortMultipartUpload]'- ProfileEvents_S3CompleteMultipartUpload Int64, -- comment 'ProfileEvents[S3CompleteMultipartUpload]'- ProfileEvents_S3PutObject Int64, -- comment 'ProfileEvents[S3PutObject]'- ProfileEvents_S3GetObject Int64, -- comment 'ProfileEvents[S3GetObject]'- ProfileEvents_ReadBufferFromS3Bytes Int64, -- comment 'ProfileEvents[ReadBufferFromS3Bytes]'- ProfileEvents_WriteBufferFromS3Bytes Int64, -- comment 'ProfileEvents[WriteBufferFromS3Bytes]'-- -- log_comment contains mixed data quality, we may want to copy something from it, but overall is full of data- -- log_comment String, -- comment 'Log comment. It can be set to arbitrary string no longer than max_query_size. An empty string if it is not defined.',-- -- columns extracted from log_comment, prefixed with lc_- lc_workflow LowCardinality(String), -- comment 'log_comment[workflow]',- lc_kind LowCardinality(String), -- comment 'log_comment[kind]',- lc_id String, -- comment 'log_comment[id]',- lc_route_id String, -- comment 'log_comment[route_id]',-- lc_access_method LowCardinality(String), -- comment 'log_comment[access_method]',- lc_api_key_label String,- lc_api_key_mask String,-- lc_query_type LowCardinality(String), -- comment 'log_comment[query_type]',- lc_product LowCardinality(String), -- comment 'log_comment[product]',- lc_chargeable Bool, -- comment 'log_comment[chargeable]',- lc_name String, -- comment 'log_comment[name]',- lc_client_query_id String, -- comment 'log_comment[client_query_id]'-- lc_org_id String, -- comment 'log_comment[org_id]',- lc_team_id Int64, -- comment 'log_comment[team_id]',- lc_user_id Int64, -- comment 'log_comment[user_id]',- lc_is_impersonated Bool, -- comment 'log_comment[is_impersonated]',- lc_session_id String, -- comment 'log_comment[session_id]',-- lc_dashboard_id Int64, -- comment 'log_comment[dashboard_id]',- lc_insight_id Int64, -- comment 'log_comment[insight_id]',- lc_cohort_id Int64, -- comment 'log_comment[cohort_id]',- lc_batch_export_id String, -- comment 'log_comment[batch_export_id]'- lc_experiment_id Int64, -- comment 'log_comment[experiment_id]',- lc_experiment_feature_flag_key String, -- comment 'log_comment[experiment_feature_flag_key]'-- -- for entries with 'query' tag- lc_query__kind LowCardinality(String), -- comment 'log_comment[query][kind]', if the query has a source, then source kind is used,- lc_query__query String, -- comment 'log_comment[query][query]', if query has source, the source query is used instead,-- -- for temporal worflows (ph_kind='temporal')- lc_temporal__workflow_namespace String, -- comment 'JSONExtractString(log_comment, temporal, workflow_namespace)',- lc_temporal__workflow_type String, -- comment 'JSONExtractString(log_comment, temporal, workflow_type)',- lc_temporal__workflow_id String, -- comment 'JSONExtractString(log_comment, temporal, workflow_id)',- lc_temporal__workflow_run_id String, -- comment 'JSONExtractString(log_comment, temporal, workflow_run_id)',- lc_temporal__activity_type String, -- comment 'JSONExtractString(log_comment, temporal, activity_type)',- lc_temporal__activity_id String, -- comment 'JSONExtractString(log_comment, temporal, activity_id)',- lc_temporal__attempt Int64, -- comment 'JSONExtractString(log_comment, temporal, attempt)'-- -- dagster workflows- lc_dagster__job_name String, -- comment JSONExtractString(log_comment, 'dagster', 'job_name')- lc_dagster__run_id String, -- comment JSONExtractString(log_comment, 'dagster', 'run_id')- lc_dagster__owner String, -- comment JSONExtractString(log_comment, 'dagster', 'tags', 'owner')-- team_id Int64 ALIAS lc_team_id -- alias so that hogql generator can filter by team_id-) ENGINE = {engine}-"""---def QUERY_LOG_ARCHIVE_NEW_TABLE_SQL(table_name="query_log_archive_new", engine=None, include_table_clauses=True):- return """-CREATE TABLE IF NOT EXISTS {table_name} (- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart' = 1, 'QueryFinish' = 2, 'ExceptionBeforeStart' = 3, 'ExceptionWhileProcessing' = 4),-- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,-- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,-- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),-- exception_code Int32,- exception_name String ALIAS errorCodeToName(exception_code),- exception String,- stack_trace String,-- ProfileEvents_RealTimeMicroseconds Int64,- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64,-- ProfileEvents_S3Clients Int64,- ProfileEvents_S3DeleteObjects Int64,- ProfileEvents_S3CopyObject Int64,- ProfileEvents_S3ListObjects Int64,- ProfileEvents_S3HeadObject Int64,- ProfileEvents_S3GetObjectAttributes Int64,- ProfileEvents_S3CreateMultipartUpload Int64,- ProfileEvents_S3UploadPartCopy Int64,- ProfileEvents_S3UploadPart Int64,- ProfileEvents_S3AbortMultipartUpload Int64,- ProfileEvents_S3CompleteMultipartUpload Int64,- ProfileEvents_S3PutObject Int64,- ProfileEvents_S3GetObject Int64,- ProfileEvents_ReadBufferFromS3Bytes Int64,- ProfileEvents_WriteBufferFromS3Bytes Int64,-- ProfileEvents Map(String, UInt64),-- lc_workflow LowCardinality(String),- lc_kind LowCardinality(String),- lc_id String,- lc_route_id String,-- lc_access_method LowCardinality(String),- lc_api_key_label String,- lc_api_key_mask String,-- lc_query_type LowCardinality(String),- lc_product LowCardinality(String),- lc_chargeable Bool,- lc_name String,- lc_request_name String,- lc_client_query_id String,-- lc_org_id String,- team_id Int64, -- renamed from lc_team_id, no longer an alias- lc_user_id Int64,- lc_is_impersonated Bool,- lc_session_id String,-- lc_dashboard_id Int64,- lc_insight_id Int64,- lc_cohort_id Int64,- lc_batch_export_id String,- lc_experiment_id Int64,- lc_experiment_feature_flag_key String,-- lc_alert_config_id String,- lc_feature LowCardinality(String),- lc_table_id String,- lc_warehouse_query Bool,- lc_person_on_events_mode LowCardinality(String),- lc_service_name String,- lc_workload LowCardinality(String),-- lc_query__kind LowCardinality(String),- lc_query__query String,- lc_query String,-- lc_temporal__workflow_namespace String,- lc_temporal__workflow_type String,- lc_temporal__workflow_id String,- lc_temporal__workflow_run_id String,- lc_temporal__activity_type String,- lc_temporal__activity_id String,- lc_temporal__attempt Int64,-- lc_dagster__job_name String,- lc_dagster__run_id String,- lc_dagster__owner String,-- lc_modifiers String-) ENGINE = {engine}{table_clauses}- """.format(- table_name=table_name,- engine=engine,- table_clauses=(- """-PARTITION BY toYYYYMM(event_date)-ORDER BY (team_id, event_date, event_time, query_id)-PRIMARY KEY (team_id, event_date, event_time, query_id)"""- if include_table_clauses- else ""- ),- )---MV_SELECT_SQL = """-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,-- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,-- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,-- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,-- exception_code,- exception,- stack_trace,-- ProfileEvents['RealTimeMicroseconds'] as ProfileEvents_RealTimeMicroseconds,- ProfileEvents['OSCPUVirtualTimeMicroseconds'] as ProfileEvents_OSCPUVirtualTimeMicroseconds,-- ProfileEvents['S3Clients'] as ProfileEvents_S3Clients,- ProfileEvents['S3DeleteObjects'] as ProfileEvents_S3DeleteObjects,- ProfileEvents['S3CopyObject'] as ProfileEvents_S3CopyObject,- ProfileEvents['S3ListObjects'] as ProfileEvents_S3ListObjects,- ProfileEvents['S3HeadObject'] as ProfileEvents_S3HeadObject,- ProfileEvents['S3GetObjectAttributes'] as ProfileEvents_S3GetObjectAttributes,- ProfileEvents['S3CreateMultipartUpload'] as ProfileEvents_S3CreateMultipartUpload,- ProfileEvents['S3UploadPartCopy'] as ProfileEvents_S3UploadPartCopy,- ProfileEvents['S3UploadPart'] as ProfileEvents_S3UploadPart,- ProfileEvents['S3AbortMultipartUpload'] as ProfileEvents_S3AbortMultipartUpload,- ProfileEvents['S3CompleteMultipartUpload'] as ProfileEvents_S3CompleteMultipartUpload,- ProfileEvents['S3PutObject'] as ProfileEvents_S3PutObject,- ProfileEvents['S3GetObject'] as ProfileEvents_S3GetObject,- ProfileEvents['ReadBufferFromS3Bytes'] as ProfileEvents_ReadBufferFromS3Bytes,- ProfileEvents['WriteBufferFromS3Bytes'] as ProfileEvents_WriteBufferFromS3Bytes,-- ProfileEvents,-- JSONExtractString(log_comment, 'workflow') as lc_workflow,- JSONExtractString(log_comment, 'kind') as lc_kind,- JSONExtractString(log_comment, 'id') as lc_id,- JSONExtractString(log_comment, 'route_id') as lc_route_id,-- JSONExtractString(log_comment, 'access_method') as lc_access_method,- JSONExtractString(log_comment, 'api_key_label') as lc_api_key_label,- JSONExtractString(log_comment, 'api_key_mask') as lc_api_key_mask,-- JSONExtractString(log_comment, 'query_type') as lc_query_type,- JSONExtractString(log_comment, 'product') as lc_product,- JSONExtractInt(log_comment, 'chargeable') == 1 as lc_chargeable,- JSONExtractString(log_comment, 'name') as lc_name,- JSONExtractString(log_comment, 'request_name') as lc_request_name,- JSONExtractString(log_comment, 'client_query_id') as lc_client_query_id,-- JSONExtractString(log_comment, 'org_id') as lc_org_id,- JSONExtractInt(log_comment, 'team_id') as team_id,- JSONExtractInt(log_comment, 'user_id') as lc_user_id,- JSONExtractBool(log_comment, 'is_impersonated') as lc_is_impersonated,- JSONExtractString(log_comment, 'session_id') as lc_session_id,-- JSONExtractInt(log_comment, 'dashboard_id') as lc_dashboard_id,- JSONExtractInt(log_comment, 'insight_id') as lc_insight_id,- JSONExtractInt(log_comment, 'cohort_id') as lc_cohort_id,- JSONExtractString(log_comment, 'batch_export_id') as lc_batch_export_id,- JSONExtractInt(log_comment, 'experiment_id') as lc_experiment_id,- JSONExtractString(log_comment, 'experiment_feature_flag_key') as lc_experiment_feature_flag_key,-- JSONExtractString(log_comment, 'alert_config_id') as lc_alert_config_id,- JSONExtractString(log_comment, 'feature') as lc_feature,- JSONExtractString(log_comment, 'table_id') as lc_table_id,- JSONExtractInt(log_comment, 'warehouse_query') == 1 as lc_warehouse_query,- JSONExtractString(log_comment, 'person_on_events_mode') as lc_person_on_events_mode,- JSONExtractString(log_comment, 'service_name') as lc_service_name,- JSONExtractString(log_comment, 'workload') as lc_workload,-- -- for entries with 'query' tag, some queries have source, we should use this- if(JSONHas(log_comment, 'query', 'source'),- JSONExtractString(log_comment, 'query', 'source', 'kind'),- JSONExtractString(log_comment, 'query', 'kind')) as lc_query__kind,- multiIf(not is_initial_query, '',- JSONHas(log_comment, 'query', 'source'), JSONExtractString(log_comment, 'query', 'source', 'query'),- JSONExtractString(log_comment, 'query', 'query')) as lc_query__query,- if(is_initial_query, JSONExtractRaw(log_comment, 'query'), '') as lc_query,-- JSONExtractString(log_comment, 'temporal', 'workflow_namespace') as lc_temporal__workflow_namespace,- JSONExtractString(log_comment, 'temporal', 'workflow_type') as lc_temporal__workflow_type,- JSONExtractString(log_comment, 'temporal', 'workflow_id') as lc_temporal__workflow_id,- JSONExtractString(log_comment, 'temporal', 'workflow_run_id') as lc_temporal__workflow_run_id,- JSONExtractString(log_comment, 'temporal', 'activity_type') as lc_temporal__activity_type,- JSONExtractString(log_comment, 'temporal', 'activity_id') as lc_temporal__activity_id,- JSONExtractInt(log_comment, 'temporal', 'attempt') as lc_temporal__attempt,-- JSONExtractString(log_comment, 'dagster', 'job_name') as lc_dagster__job_name,- JSONExtractString(log_comment, 'dagster', 'run_id') as lc_dagster__run_id,- JSONExtractString(log_comment, 'dagster', 'tags', 'owner') as lc_dagster__owner,-- if(is_initial_query, JSONExtractRaw(log_comment, 'modifiers'), '') as lc_modifiers-FROM system.query_log-WHERE- type != 'QueryStart'-"""---def QUERY_LOG_ARCHIVE_NEW_MV_SQL(view_name="query_log_archive_new_mv", dest_table="query_log_archive_new"):- return """CREATE MATERIALIZED VIEW IF NOT EXISTS {view_name}-TO {dest_table}-AS {select_sql}- """.format(- view_name=view_name,- dest_table=dest_table,- select_sql=MV_SELECT_SQL,- )---def QUERY_LOG_ARCHIVE_CROSS_CLUSTER_DISTRIBUTED_TABLE_SQL(table_name=QUERY_LOG_ARCHIVE_WRITABLE_DISTRIBUTED_TABLE):- """- Distributed table for cross-cluster writes.- Used on stateless clusters to write to main cluster's query_log_archive.- """- return QUERY_LOG_ARCHIVE_NEW_TABLE_SQL(- table_name=table_name,- engine=Distributed(data_table="query_log_archive", cluster=settings.CLICKHOUSE_SINGLE_SHARD_CLUSTER),- include_table_clauses=False,- )---# V4 - adding lc_request_name-ADD_LC_REQUEST_NAME_SQL = """-ALTER TABLE query_log_archive ADD COLUMN IF NOT EXISTS lc_request_name String AFTER lc_name-"""---def QUERY_LOG_ARCHIVE_MV_V4_SQL():- return """-ALTER TABLE query_log_archive_mv MODIFY QUERY-{select_sql}- """.format(select_sql=MV_SELECT_SQL)---# V5 - adding exception_name-ADD_EXCEPTION_NAME_SQL = """-ALTER TABLE query_log_archive ADD COLUMN IF NOT EXISTS exception_name String ALIAS errorCodeToName(exception_code) AFTER exception_code-"""---# V6 - adding lc_is_impersonated for tracking impersonation in queries-def QUERY_LOG_ARCHIVE_ADD_IS_IMPERSONATED_SQL(table=QUERY_LOG_ARCHIVE_DATA_TABLE):- return """- ALTER TABLE {table} ADD COLUMN IF NOT EXISTS lc_is_impersonated Bool AFTER lc_user_id- """.format(table=table)---# V7 - sharded query_log_archive-def SHARDED_QUERY_LOG_ARCHIVE_TABLE_ENGINE():- return MergeTreeEngine(SHARDED_QUERY_LOG_ARCHIVE_TABLE, replication_scheme=ReplicationScheme.SHARDED)---def SHARDED_QUERY_LOG_ARCHIVE_TABLE_SQL():- return QUERY_LOG_ARCHIVE_NEW_TABLE_SQL(- table_name=SHARDED_QUERY_LOG_ARCHIVE_TABLE,- engine=SHARDED_QUERY_LOG_ARCHIVE_TABLE_ENGINE(),- )---def DISTRIBUTED_QUERY_LOG_ARCHIVE_TABLE_SQL():- return QUERY_LOG_ARCHIVE_NEW_TABLE_SQL(- table_name=QUERY_LOG_ARCHIVE_DATA_TABLE,- engine=Distributed(- data_table=SHARDED_QUERY_LOG_ARCHIVE_TABLE,- sharding_key="cityHash64(query_id)",- cluster=settings.CLICKHOUSE_CLUSTER,- ),- include_table_clauses=False,- )---def SHARDED_WRITABLE_QUERY_LOG_ARCHIVE_TABLE_SQL():- return QUERY_LOG_ARCHIVE_NEW_TABLE_SQL(- table_name=SHARDED_QUERY_LOG_ARCHIVE_WRITABLE_TABLE,- engine=Distributed(- data_table=SHARDED_QUERY_LOG_ARCHIVE_TABLE,- sharding_key="cityHash64(query_id)",- cluster=settings.CLICKHOUSE_CLUSTER,- ),- include_table_clauses=False,- )---# V8 - adding initial_query_id, is_initial_query to track subqueries, and ProfileEvents map-def QUERY_LOG_ARCHIVE_ADD_V8_COLUMNS_SQL(table=QUERY_LOG_ARCHIVE_DATA_TABLE):- return f"""- ALTER TABLE {table}- ADD COLUMN IF NOT EXISTS initial_query_id String AFTER query_id,- ADD COLUMN IF NOT EXISTS is_initial_query UInt8 AFTER initial_query_id,- ADD COLUMN IF NOT EXISTS ProfileEvents Map(String, UInt64) AFTER ProfileEvents_WriteBufferFromS3Bytes- """---# V9 - adding lc_query for storing full query JSON from log_comment-def QUERY_LOG_ARCHIVE_ADD_LC_QUERY_SQL(table=QUERY_LOG_ARCHIVE_DATA_TABLE):- return f"""- ALTER TABLE {table} ADD COLUMN IF NOT EXISTS lc_query String AFTER lc_query__query- """---# V10 - adding lc_modifiers to store HogQL query modifiers-def QUERY_LOG_ARCHIVE_ADD_MODIFIERS_COLUMN_SQL(table=QUERY_LOG_ARCHIVE_DATA_TABLE):- return f"""- ALTER TABLE {table}- ADD COLUMN IF NOT EXISTS lc_modifiers String AFTER lc_dagster__owner- """---def QUERY_LOG_ARCHIVE_UPDATE_MV_SQL(mv_name=QUERY_LOG_ARCHIVE_MV):- return f"""ALTER TABLE {mv_name} MODIFY QUERY {MV_SELECT_SQL}"""---# ============================================================================-# OPS generation-# -----------------------------------------------------------------------------# Single physical data table living ONLY on the OPS cluster. Every cluster gets-# a Distributed read table (query_log_archive) and a Distributed write table-# (writable_query_log_archive) pointing at it, so logs from the whole fleet are-# archived into OPS and can be read from anywhere.-#-# log_comment is stored as a native ClickHouse JSON column holding a curated-# subset of system.query_log.log_comment (typed hints for the hot dimensions,-# SKIP for PII/bulky keys). ProfileEvents is stored as the raw Map. All lc_* and-# ProfileEvents_* columns are read-time ALIASes over those two columns, so the-# MV and the writable table only ever carry the real physical columns.-# ============================================================================--WRITABLE_QUERY_LOG_ARCHIVE_TABLE = "writable_query_log_archive"-QUERY_LOG_ARCHIVE_BUFFER_TABLE = "query_log_archive_buffer" # Buffer in front of sharded_query_log_archive, on OPS-QUERY_LOG_ARCHIVE_OPS_MV = "ops_query_log_archive_mv" # slim MV -> writable_query_log_archive, on every cluster--# Curated JSON subset of log_comment. Keys not hinted here are still kept as-# dynamic paths (bounded by max_dynamic_paths) UNLESS listed in SKIP. The SKIP-# list drops PII (user_email, http_*) and bulky objects (query_settings, timings,-# filter, hogql_features) so they never reach the archive. The `query` and-# `modifiers` subtrees are intentionally NOT skipped so the lc_query* / lc_modifiers-# aliases can read them back.-LOG_COMMENT_JSON_TYPE = """JSON(- max_dynamic_paths = 256,- team_id Int64,- user_id Int64,- org_id String,- session_id String,- access_method LowCardinality(String),- api_key_label String,- api_key_mask String,- workflow LowCardinality(String),- kind LowCardinality(String),- id String,- route_id String,- query_type LowCardinality(String),- product LowCardinality(String),- chargeable Bool,- name String,- request_name String,- client_query_id String,- is_impersonated Bool,- dashboard_id Int64,- insight_id Int64,- cohort_id Int64,- batch_export_id String,- experiment_id Int64,- experiment_feature_flag_key String,- alert_config_id String,- feature LowCardinality(String),- table_id String,- warehouse_query Bool,- person_on_events_mode LowCardinality(String),- service_name String,- workload LowCardinality(String),- `temporal.workflow_namespace` String,- `temporal.workflow_type` String,- `temporal.workflow_id` String,- `temporal.workflow_run_id` String,- `temporal.activity_type` String,- `temporal.activity_id` String,- `temporal.attempt` Int64,- `dagster.job_name` String,- `dagster.run_id` String,- `dagster.tags.owner` String,- SKIP user_email,- SKIP query_settings,- SKIP timings,- SKIP `filter`,- SKIP hogql_features,- SKIP http_referer,- SKIP http_user_agent,- SKIP http_request_id,- SKIP cache_key- )"""--# Real columns copied verbatim from system.query_log, plus the physical team_id-# (it is part of the sort key so it cannot be an alias), the JSON log_comment and-# the raw ProfileEvents map. These are exactly the columns the MV inserts.-_QUERY_LOG_ARCHIVE_PHYSICAL_COLUMNS = """- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart' = 1, 'QueryFinish' = 2, 'ExceptionBeforeStart' = 3, 'ExceptionWhileProcessing' = 4),-- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,-- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,-- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),-- exception_code Int32,- exception String,- stack_trace String,-- team_id Int64,- log_comment {log_comment_type},- ProfileEvents Map(String, UInt64)""".format(log_comment_type=LOG_COMMENT_JSON_TYPE)--# HogQL cost planner tags (posthog/hogql/cost/). These keys have no type hint in LOG_COMMENT_JSON_TYPE, so the-# JSON column keeps them as Dynamic paths that read as NULL when absent. dynamicElement extracts the typed value-# and ifNull gives the same '' / 0 default the hinted lc_* columns have. It is the function form of the `.:Type`-# subcolumn syntax, which the HCL introspection parser (hclexp) cannot read back from SHOW CREATE TABLE.-_COST_PLANNER_ALIAS_COLUMNS = (- "lc_plan_fingerprint String ALIAS ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), '')",- "lc_estimated_rows Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0)",- "lc_estimated_bytes Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0)",-)---def QUERY_LOG_ARCHIVE_ADD_COST_PLANNER_ALIASES_SQL(table=QUERY_LOG_ARCHIVE_DATA_TABLE):- return f"ALTER TABLE {table} " + ", ".join(- f"ADD COLUMN IF NOT EXISTS {column}" for column in _COST_PLANNER_ALIAS_COLUMNS- )---# Read-time aliases. lc_* read the curated JSON subset; ProfileEvents_* read the-# raw map; exception_name keeps its derived form. The lc_query* / lc_modifiers-# aliases reproduce the previous MV logic (source preference + is_initial_query-# gating) against the serialized JSON.-_QUERY_LOG_ARCHIVE_ALIAS_COLUMNS = """- exception_name String ALIAS errorCodeToName(exception_code),-- ProfileEvents_RealTimeMicroseconds Int64 ALIAS ProfileEvents['RealTimeMicroseconds'],- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64 ALIAS ProfileEvents['OSCPUVirtualTimeMicroseconds'],- ProfileEvents_S3Clients Int64 ALIAS ProfileEvents['S3Clients'],- ProfileEvents_S3DeleteObjects Int64 ALIAS ProfileEvents['S3DeleteObjects'],- ProfileEvents_S3CopyObject Int64 ALIAS ProfileEvents['S3CopyObject'],- ProfileEvents_S3ListObjects Int64 ALIAS ProfileEvents['S3ListObjects'],- ProfileEvents_S3HeadObject Int64 ALIAS ProfileEvents['S3HeadObject'],- ProfileEvents_S3GetObjectAttributes Int64 ALIAS ProfileEvents['S3GetObjectAttributes'],- ProfileEvents_S3CreateMultipartUpload Int64 ALIAS ProfileEvents['S3CreateMultipartUpload'],- ProfileEvents_S3UploadPartCopy Int64 ALIAS ProfileEvents['S3UploadPartCopy'],- ProfileEvents_S3UploadPart Int64 ALIAS ProfileEvents['S3UploadPart'],- ProfileEvents_S3AbortMultipartUpload Int64 ALIAS ProfileEvents['S3AbortMultipartUpload'],- ProfileEvents_S3CompleteMultipartUpload Int64 ALIAS ProfileEvents['S3CompleteMultipartUpload'],- ProfileEvents_S3PutObject Int64 ALIAS ProfileEvents['S3PutObject'],- ProfileEvents_S3GetObject Int64 ALIAS ProfileEvents['S3GetObject'],- ProfileEvents_ReadBufferFromS3Bytes Int64 ALIAS ProfileEvents['ReadBufferFromS3Bytes'],- ProfileEvents_WriteBufferFromS3Bytes Int64 ALIAS ProfileEvents['WriteBufferFromS3Bytes'],-- lc_workflow LowCardinality(String) ALIAS log_comment.workflow,- lc_kind LowCardinality(String) ALIAS log_comment.kind,- lc_id String ALIAS log_comment.id::String,- lc_route_id String ALIAS log_comment.route_id::String,- lc_access_method LowCardinality(String) ALIAS log_comment.access_method,- lc_api_key_label String ALIAS log_comment.api_key_label::String,- lc_api_key_mask String ALIAS log_comment.api_key_mask::String,- lc_query_type LowCardinality(String) ALIAS log_comment.query_type,- lc_product LowCardinality(String) ALIAS log_comment.product,- lc_chargeable Bool ALIAS log_comment.chargeable,- lc_name String ALIAS log_comment.name::String,- lc_request_name String ALIAS log_comment.request_name::String,- lc_client_query_id String ALIAS log_comment.client_query_id::String,- lc_org_id String ALIAS log_comment.org_id::String,- lc_user_id Int64 ALIAS log_comment.user_id,- lc_is_impersonated Bool ALIAS log_comment.is_impersonated,- lc_session_id String ALIAS log_comment.session_id::String,- lc_dashboard_id Int64 ALIAS log_comment.dashboard_id,- lc_insight_id Int64 ALIAS log_comment.insight_id,- lc_cohort_id Int64 ALIAS log_comment.cohort_id,- lc_batch_export_id String ALIAS log_comment.batch_export_id::String,- lc_experiment_id Int64 ALIAS log_comment.experiment_id,- lc_experiment_feature_flag_key String ALIAS log_comment.experiment_feature_flag_key::String,- lc_alert_config_id String ALIAS log_comment.alert_config_id::String,- lc_feature LowCardinality(String) ALIAS log_comment.feature,- lc_table_id String ALIAS log_comment.table_id::String,- lc_warehouse_query Bool ALIAS log_comment.warehouse_query,- lc_person_on_events_mode LowCardinality(String) ALIAS log_comment.person_on_events_mode,- lc_service_name String ALIAS log_comment.service_name::String,- lc_workload LowCardinality(String) ALIAS log_comment.workload,-- lc_query__kind LowCardinality(String) ALIAS if(JSONHas(toString(log_comment), 'query', 'source'),- JSONExtractString(toString(log_comment), 'query', 'source', 'kind'),- JSONExtractString(toString(log_comment), 'query', 'kind')),- lc_query__query String ALIAS multiIf(not is_initial_query, '',- JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'),- JSONExtractString(toString(log_comment), 'query', 'query')),- lc_query String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), ''),-- lc_temporal__workflow_namespace String ALIAS log_comment.`temporal.workflow_namespace`::String,- lc_temporal__workflow_type String ALIAS log_comment.`temporal.workflow_type`::String,- lc_temporal__workflow_id String ALIAS log_comment.`temporal.workflow_id`::String,- lc_temporal__workflow_run_id String ALIAS log_comment.`temporal.workflow_run_id`::String,- lc_temporal__activity_type String ALIAS log_comment.`temporal.activity_type`::String,- lc_temporal__activity_id String ALIAS log_comment.`temporal.activity_id`::String,- lc_temporal__attempt Int64 ALIAS log_comment.`temporal.attempt`,-- lc_dagster__job_name String ALIAS log_comment.`dagster.job_name`::String,- lc_dagster__run_id String ALIAS log_comment.`dagster.run_id`::String,- lc_dagster__owner String ALIAS log_comment.`dagster.tags.owner`::String,-- lc_modifiers String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), ''),-- {cost_planner_aliases}""".format(cost_planner_aliases=",\n ".join(_COST_PLANNER_ALIAS_COLUMNS))--_QUERY_LOG_ARCHIVE_OPS_TABLE_CLAUSES = """-PARTITION BY toYYYYMM(event_date)-ORDER BY (team_id, event_date, event_time, query_id)-PRIMARY KEY (team_id, event_date, event_time, query_id)"""---def QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(- table_name, engine, include_aliases=True, include_table_clauses=True, settings=None-):- """JSON-backed query_log_archive table.-- include_aliases=True for the data table and read tables (exposes lc_* / ProfileEvents_*).- include_aliases=False for the writable distributed table (physical, insertable columns only).- """- columns = _QUERY_LOG_ARCHIVE_PHYSICAL_COLUMNS- if include_aliases:- columns = f"{columns},\n{_QUERY_LOG_ARCHIVE_ALIAS_COLUMNS}"- return "CREATE TABLE IF NOT EXISTS {table_name} (\n{columns}\n) ENGINE = {engine}{table_clauses} {settings}".format(- table_name=table_name,- columns=columns,- engine=engine,- table_clauses=_QUERY_LOG_ARCHIVE_OPS_TABLE_CLAUSES if include_table_clauses else "",- settings=settings if settings else "",- )---def SHARDED_QUERY_LOG_ARCHIVE_OPS_ENGINE():- # OPS is a single-shard (1xN) cluster: replicated, not sharded.- return MergeTreeEngine(SHARDED_QUERY_LOG_ARCHIVE_TABLE, replication_scheme=ReplicationScheme.REPLICATED)---def SHARDED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL():- return QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(- table_name=SHARDED_QUERY_LOG_ARCHIVE_TABLE,- engine=SHARDED_QUERY_LOG_ARCHIVE_OPS_ENGINE(),- settings="SETTINGS object_shared_data_serialization_version='map_with_buckets',object_serialization_version='v3'",- )---def DISTRIBUTED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(cluster=None):- """Distributed read table (query_log_archive), created on every cluster, pointing at OPS.-- Reads are served by the v3 per-query aggregate (sharded_query_log_archive_v3), so this table- carries the v3 columns. The JSON-backed sharded_query_log_archive below is still written to,- but nothing reads it through query_log_archive.- """- return DISTRIBUTED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL(table_name=QUERY_LOG_ARCHIVE_DATA_TABLE, cluster=cluster)---def QUERY_LOG_ARCHIVE_BUFFER_OPS_TABLE_SQL():- """Buffer table on OPS, sitting in front of sharded_query_log_archive.-- Every cluster's writable Distributed routes inserts here; the Buffer batches the- many small per-cluster MV inserts in memory and flushes them to the underlying- ReplicatedMergeTree, cutting part churn. Physical (insertable) columns only — the- structure must match the destination's real columns, and the lc_* / ProfileEvents_*- aliases are read-time only. Rows still buffered are not yet visible through the- read path (query_log_archive -> sharded_query_log_archive).- """- return QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(- table_name=QUERY_LOG_ARCHIVE_BUFFER_TABLE,- engine=Buffer(- destination_table=SHARDED_QUERY_LOG_ARCHIVE_TABLE,- num_layers=16,- min_time=10,- max_time=60,- min_rows=10_000,- max_rows=1_000_000,- min_bytes=10_000_000,- max_bytes=100_000_000,- ),- include_aliases=False,- include_table_clauses=False,- )---def WRITABLE_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(cluster=None):- """Distributed write table carrying physical columns only, pointing at the OPS Buffer."""- return QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(- table_name=WRITABLE_QUERY_LOG_ARCHIVE_TABLE,- engine=Distributed(- data_table=QUERY_LOG_ARCHIVE_BUFFER_TABLE,- cluster=cluster or settings.CLICKHOUSE_OPS_CLUSTER,- ),- include_aliases=False,- include_table_clauses=False,- )---# The MV stays trivial: real columns pass through, team_id is extracted as a concrete-# value (sort key), and the raw log_comment String is cast into the JSON column on insert-# (the column's type hints + SKIP rules do the curation). ProfileEvents is copied as-is.-MV_SELECT_SQL_OPS = """-SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,-- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,-- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,-- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,-- exception_code,- exception,- stack_trace,-- JSONExtractInt(log_comment, 'team_id') as team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents-FROM system.query_log-WHERE- type != 'QueryStart'-"""---def QUERY_LOG_ARCHIVE_OPS_MV_SQL(view_name, dest_table):- return "CREATE MATERIALIZED VIEW IF NOT EXISTS {view_name}\nTO {dest_table}\nAS {select_sql}".format(- view_name=view_name,- dest_table=dest_table,- select_sql=MV_SELECT_SQL_OPS,- )# ============================================================================@@ -867,13 +16,12 @@ def QUERY_LOG_ARCHIVE_OPS_MV_SQL(view_name, dest_table):# MV zeroes the descriptive columns on non-initial rows so max() picks the# initial row.#-# Same topology as the JSON-backed generation: the data table and the Buffer-# live only on OPS; the MV, the writable Distributed and the read Distributed-# live on every cluster. query_log_archive reads this table too.+# The data table and the Buffer live only on OPS; the MV, the writable+# Distributed and the read Distributed live on every cluster. query_log_archive+# reads this table too.# ============================================================================SHARDED_QUERY_LOG_ARCHIVE_V3_TABLE = "sharded_query_log_archive_v3"-QUERY_LOG_ARCHIVE_V3_TABLE = "query_log_archive_v3"QUERY_LOG_ARCHIVE_V3_BUFFER_TABLE = "query_log_archive_v3_buffer"WRITABLE_QUERY_LOG_ARCHIVE_V3_TABLE = "writable_query_log_archive_v3"QUERY_LOG_ARCHIVE_V3_MV = "ops_query_log_archive_v3_mv"@@ -1081,17 +229,17 @@ def _v3_plain_table_sql(table_name: str, engine: object, include_aliases: bool))-def DISTRIBUTED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL(table_name=QUERY_LOG_ARCHIVE_V3_TABLE, cluster=None):- """Distributed read table over the v3 data table, created on every cluster."""+def DISTRIBUTED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(cluster=None):+ """Distributed read table (query_log_archive) over the v3 data table, created on every cluster."""return _v3_plain_table_sql(- table_name,+ QUERY_LOG_ARCHIVE_DATA_TABLE,Distributed(data_table=SHARDED_QUERY_LOG_ARCHIVE_V3_TABLE, cluster=cluster or settings.CLICKHOUSE_OPS_CLUSTER),include_aliases=True,)def QUERY_LOG_ARCHIVE_V3_BUFFER_TABLE_SQL():- """Buffer on OPS in front of the v3 data table. Same thresholds as the JSON-backed generation."""+ """Buffer on OPS in front of the v3 data table."""return _v3_plain_table_sql(QUERY_LOG_ARCHIVE_V3_BUFFER_TABLE,Buffer(@@ -1273,67 +421,3 @@ def QUERY_LOG_ARCHIVE_V3_MV_SQL():columns=",\n ".join(f"{name} {type_}" for name, type_, _ in _V3_PHYSICAL_COLUMNS),select_sql=MV_SELECT_SQL_V3,)---# ============================================================================-# Daily aggregate exposed to the data warehouse-# -----------------------------------------------------------------------------# A non-materialized view that rolls query_log_archive up to one row per day per-# (team, user, query-attribution) tuple. The data warehouse ClickHouse source-# (products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse) syncs it into an internal-# project incrementally on `day`, so query-cost analysis can live in PostHog-# instead of Metabase.-#-# Reads the OPS-local sharded_query_log_archive directly (it carries the lc_* /-# ProfileEvents_* aliases and, being replicated, holds the full dataset on every-# OPS replica) so the scan stays on OPS and never touches the distributed read path.-#-# is_initial_query drops the per-shard sub-queries that would otherwise double-count.-# event_date < today() exposes a day only once it is complete: the warehouse sync-# advances its `day` cursor and never revisits a day, so a partial final day must-# never be visible.-# ============================================================================-DAILY_AGGREGATED_QUERY_LOG_ARCHIVE_VIEW = "daily_aggregated_query_log_archive"---def DAILY_AGGREGATED_QUERY_LOG_ARCHIVE_VIEW_SQL(view_name=DAILY_AGGREGATED_QUERY_LOG_ARCHIVE_VIEW):- return f"""-CREATE VIEW IF NOT EXISTS {view_name} AS-SELECT- event_date AS day,- team_id,- user,- current_database,- query_kind,- lc_kind,- lc_access_method,- lc_query_type,- lc_product,- lc_name,- lc_feature,- lc_query__kind,- lc_api_key_label,- count() AS query_count,- sum(read_bytes) AS read_bytes,- sum(read_rows) AS read_rows,- sum(query_duration_ms) AS query_duration_ms,- sum(ProfileEvents_OSCPUVirtualTimeMicroseconds) AS cpu_microseconds,- countIf(exception_code != 0) AS error_count,- countIf(exception_code IN (159, 160, 241)) AS timeout_oom_count-FROM {SHARDED_QUERY_LOG_ARCHIVE_TABLE}-WHERE is_initial_query AND event_date < today()-GROUP BY- day,- team_id,- user,- current_database,- query_kind,- lc_kind,- lc_access_method,- lc_query_type,- lc_product,- lc_name,- lc_feature,- lc_query__kind,- lc_api_key_label-"""diff --git a/posthog/clickhouse/schema.py b/posthog/clickhouse/schema.pyindex df9a0c7ec452..1433d349dc72 100644--- a/posthog/clickhouse/schema.py+++ b/posthog/clickhouse/schema.py@@ -149,16 +149,9 @@ from posthog.clickhouse.property_values import ()from posthog.clickhouse.query_log_archive import (DISTRIBUTED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,- DISTRIBUTED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL,- QUERY_LOG_ARCHIVE_BUFFER_OPS_TABLE_SQL,- QUERY_LOG_ARCHIVE_OPS_MV,- QUERY_LOG_ARCHIVE_OPS_MV_SQL,QUERY_LOG_ARCHIVE_V3_BUFFER_TABLE_SQL,QUERY_LOG_ARCHIVE_V3_MV_SQL,- SHARDED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,SHARDED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL,- WRITABLE_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,- WRITABLE_QUERY_LOG_ARCHIVE_TABLE,WRITABLE_QUERY_LOG_ARCHIVE_V3_TABLE_SQL,)from posthog.clickhouse.traces import (@@ -469,8 +462,6 @@ CREATE_MERGETREE_TABLE_QUERIES = (WEB_STATS_SQL,WEB_BOUNCES_SQL,WEB_PRE_AGGREGATED_TEAM_SELECTION_TABLE_SQL,- SHARDED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,- QUERY_LOG_ARCHIVE_BUFFER_OPS_TABLE_SQL,SHARDED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL,QUERY_LOG_ARCHIVE_V3_BUFFER_TABLE_SQL,SHARDED_WAREHOUSE_OBJECT_READS_DAILY_TABLE_SQL,@@ -565,8 +556,6 @@ CREATE_DISTRIBUTED_TABLE_QUERIES = (WRITABLE_FLAG_EVALUATIONS_TABLE_SQL,DISTRIBUTED_FLAG_EVALUATIONS_TABLE_SQL,DISTRIBUTED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,- WRITABLE_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,- DISTRIBUTED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL,WRITABLE_QUERY_LOG_ARCHIVE_V3_TABLE_SQL,DISTRIBUTED_SYSTEM_PROCESSES_TABLE_SQL,COHORT_MEMBERSHIP_WRITABLE_TABLE_SQL,@@ -704,7 +693,6 @@ CREATE_MV_TABLE_QUERIES = (RAW_SESSIONS_TABLE_MV_RECORDINGS_SQL_V3,HEATMAPS_TABLE_MV_SQL,FLAG_EVALUATIONS_MV_SQL,- QUERY_LOG_ARCHIVE_OPS_MV_SQL(view_name=QUERY_LOG_ARCHIVE_OPS_MV, dest_table=WRITABLE_QUERY_LOG_ARCHIVE_TABLE),QUERY_LOG_ARCHIVE_V3_MV_SQL,COHORT_MEMBERSHIP_MV_SQL,PRECALCULATED_EVENTS_MV_SQL,diff --git a/posthog/clickhouse/test/__snapshots__/test_schema.ambr b/posthog/clickhouse/test/__snapshots__/test_schema.ambrindex 306c27454939..078b4baccd5a 100644--- a/posthog/clickhouse/test/__snapshots__/test_schema.ambr+++ b/posthog/clickhouse/test/__snapshots__/test_schema.ambr@@ -5256,54 +5256,6 @@# name: test_create_table_query[metrics_distributed]"CREATE TABLE IF NOT EXISTS posthog_test.metrics_distributed AS posthog_test.metrics2 ENGINE = Distributed('posthog_single_shard', 'posthog_test', 'metrics2')"# ----# name: test_create_table_query[ops_query_log_archive_mv]- '''- CREATE MATERIALIZED VIEW IF NOT EXISTS ops_query_log_archive_mv- TO writable_query_log_archive- AS- SELECT- hostname,- user,- query_id,- initial_query_id,- is_initial_query,- type,-- event_date,- event_time,- event_time_microseconds,- query_start_time,- query_start_time_microseconds,- query_duration_ms,-- read_rows,- read_bytes,- written_rows,- written_bytes,- result_rows,- result_bytes,- memory_usage,- peak_threads_usage,-- current_database,- query,- formatted_query,- normalized_query_hash,- query_kind,-- exception_code,- exception,- stack_trace,-- JSONExtractInt(log_comment, 'team_id') as team_id,- if(isValidJSON(log_comment), log_comment, '{}') AS log_comment,- ProfileEvents- FROM system.query_log- WHERE- type != 'QueryStart'-- '''-# ---# name: test_create_table_query[ops_query_log_archive_v3_mv]'''CREATE MATERIALIZED VIEW IF NOT EXISTS ops_query_log_archive_v3_mv@@ -6468,234 +6420,6 @@) ENGINE = Distributed('ops', 'posthog_test', 'sharded_query_log_archive_v3')'''# ----# name: test_create_table_query[query_log_archive_buffer]- '''- CREATE TABLE IF NOT EXISTS query_log_archive_buffer (-- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart' = 1, 'QueryFinish' = 2, 'ExceptionBeforeStart' = 3, 'ExceptionWhileProcessing' = 4),-- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,-- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,-- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),-- exception_code Int32,- exception String,- stack_trace String,-- team_id Int64,- log_comment JSON(- max_dynamic_paths = 256,- team_id Int64,- user_id Int64,- org_id String,- session_id String,- access_method LowCardinality(String),- api_key_label String,- api_key_mask String,- workflow LowCardinality(String),- kind LowCardinality(String),- id String,- route_id String,- query_type LowCardinality(String),- product LowCardinality(String),- chargeable Bool,- name String,- request_name String,- client_query_id String,- is_impersonated Bool,- dashboard_id Int64,- insight_id Int64,- cohort_id Int64,- batch_export_id String,- experiment_id Int64,- experiment_feature_flag_key String,- alert_config_id String,- feature LowCardinality(String),- table_id String,- warehouse_query Bool,- person_on_events_mode LowCardinality(String),- service_name String,- workload LowCardinality(String),- `temporal.workflow_namespace` String,- `temporal.workflow_type` String,- `temporal.workflow_id` String,- `temporal.workflow_run_id` String,- `temporal.activity_type` String,- `temporal.activity_id` String,- `temporal.attempt` Int64,- `dagster.job_name` String,- `dagster.run_id` String,- `dagster.tags.owner` String,- SKIP user_email,- SKIP query_settings,- SKIP timings,- SKIP `filter`,- SKIP hogql_features,- SKIP http_referer,- SKIP http_user_agent,- SKIP http_request_id,- SKIP cache_key- ),- ProfileEvents Map(String, UInt64)- ) ENGINE = Buffer('posthog_test', 'sharded_query_log_archive', 16, 10, 60, 10000, 1000000, 10000000, 100000000)- '''-# ----# name: test_create_table_query[query_log_archive_v3]- '''- CREATE TABLE IF NOT EXISTS query_log_archive_v3 (- initial_query_start_time DateTime64(6, 'UTC'),- team_id Int64,- initial_query_id String,- is_initial_query SimpleAggregateFunction(max, UInt8),- hostname SimpleAggregateFunction(max, LowCardinality(String)),- user SimpleAggregateFunction(max, LowCardinality(String)),- type SimpleAggregateFunction(max, Enum8('QueryStart' = 1, 'QueryFinish' = 2, 'ExceptionBeforeStart' = 3, 'ExceptionWhileProcessing' = 4)),- event_time_microseconds SimpleAggregateFunction(max, DateTime64(6, 'UTC')),- query_duration_ms SimpleAggregateFunction(max, UInt64),- read_rows SimpleAggregateFunction(sum, UInt64),- read_bytes SimpleAggregateFunction(sum, UInt64),- written_rows SimpleAggregateFunction(sum, UInt64),- written_bytes SimpleAggregateFunction(sum, UInt64),- result_rows SimpleAggregateFunction(sum, UInt64),- result_bytes SimpleAggregateFunction(sum, UInt64),- memory_usage SimpleAggregateFunction(max, UInt64),- memory_usage_sum SimpleAggregateFunction(sum, UInt64),- peak_threads_usage SimpleAggregateFunction(sum, UInt64),- execution_count SimpleAggregateFunction(sum, UInt64),- current_database SimpleAggregateFunction(max, LowCardinality(String)),- query SimpleAggregateFunction(max, String),- normalized_query_hash SimpleAggregateFunction(max, UInt64),- query_kind_by_root SimpleAggregateFunction(max, Tuple(UInt8, String)),- tables SimpleAggregateFunction(max, Array(String)),- exception_code SimpleAggregateFunction(max, Int32),- exception SimpleAggregateFunction(max, String),- stack_trace SimpleAggregateFunction(max, String),- ProfileEvents_SelectedRows SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_RealTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_OSCPUVirtualTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_UserTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SystemTimeMicroseconds SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedParts SimpleAggregateFunction(sum, UInt64),- ProfileEvents_SelectedMarks SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkReceiveBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_NetworkSendBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromFileDescriptorReadBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromFileDescriptorWriteBytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3Clients SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3DeleteObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CopyObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3ListObjects SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3HeadObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObjectAttributes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CreateMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPartCopy SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3UploadPart SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3AbortMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3CompleteMultipartUpload SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3PutObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_S3GetObject SimpleAggregateFunction(sum, UInt64),- ProfileEvents_ReadBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- ProfileEvents_WriteBufferFromS3Bytes SimpleAggregateFunction(sum, UInt64),- lc_org_id SimpleAggregateFunction(max, String),- lc_user_id SimpleAggregateFunction(max, Int64),- lc_session_id SimpleAggregateFunction(max, String),- lc_is_impersonated SimpleAggregateFunction(max, Bool),- lc_workflow SimpleAggregateFunction(max, LowCardinality(String)),- lc_kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_id SimpleAggregateFunction(max, String),- lc_route_id SimpleAggregateFunction(max, String),- lc_access_method SimpleAggregateFunction(max, LowCardinality(String)),- lc_api_key_label SimpleAggregateFunction(max, String),- lc_api_key_mask SimpleAggregateFunction(max, String),- lc_query_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_product SimpleAggregateFunction(max, LowCardinality(String)),- lc_chargeable SimpleAggregateFunction(max, Bool),- lc_name SimpleAggregateFunction(max, String),- lc_request_name SimpleAggregateFunction(max, String),- lc_client_query_id SimpleAggregateFunction(max, String),- lc_dashboard_id SimpleAggregateFunction(max, Int64),- lc_insight_id SimpleAggregateFunction(max, Int64),- lc_cohort_id SimpleAggregateFunction(max, Int64),- lc_batch_export_id SimpleAggregateFunction(max, String),- lc_experiment_id SimpleAggregateFunction(max, Int64),- lc_experiment_feature_flag_key SimpleAggregateFunction(max, String),- lc_alert_config_id SimpleAggregateFunction(max, String),- lc_feature SimpleAggregateFunction(max, LowCardinality(String)),- lc_table_id SimpleAggregateFunction(max, String),- lc_warehouse_query SimpleAggregateFunction(max, Bool),- lc_person_on_events_mode SimpleAggregateFunction(max, LowCardinality(String)),- lc_service_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_workload SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__kind SimpleAggregateFunction(max, LowCardinality(String)),- lc_query__query SimpleAggregateFunction(max, String),- lc_query SimpleAggregateFunction(max, String),- lc_modifiers SimpleAggregateFunction(max, String),- lc_temporal__workflow_namespace SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__workflow_id SimpleAggregateFunction(max, String),- lc_temporal__workflow_run_id SimpleAggregateFunction(max, String),- lc_temporal__activity_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_temporal__activity_id SimpleAggregateFunction(max, String),- lc_temporal__attempt SimpleAggregateFunction(max, Int64),- lc_dagster__job_name SimpleAggregateFunction(max, LowCardinality(String)),- lc_dagster__run_id SimpleAggregateFunction(max, String),- lc_dagster__owner SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_name SimpleAggregateFunction(max, String),- lc_experiment_metric_name SimpleAggregateFunction(max, String),- lc_experiment_execution_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_funnel_order_type SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_exposures_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_metric_events_path SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_query_surface SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_precompute_table SimpleAggregateFunction(max, String),- lc_experiment_query_group_id SimpleAggregateFunction(max, String),- lc_experiment_precompute_skip_reason SimpleAggregateFunction(max, LowCardinality(String)),- lc_experiment_scan_date_from SimpleAggregateFunction(max, String),- lc_experiment_scan_date_to SimpleAggregateFunction(max, String),- lc_precompute_window_start SimpleAggregateFunction(max, String),- lc_precompute_window_end SimpleAggregateFunction(max, String),- lc_plan_fingerprint SimpleAggregateFunction(max, String),- lc_estimated_rows SimpleAggregateFunction(max, Int64),- lc_estimated_bytes SimpleAggregateFunction(max, Int64),- query_id String,- event_time DateTime('UTC'),- event_date Date,- query_start_time DateTime('UTC'),- query_start_time_microseconds DateTime64(6, 'UTC'),- query_kind LowCardinality(String),- formatted_query String,- query_shape String,- hogql_shape String,- exception_name String,- ProfileEvents Map(String, UInt64)- ) ENGINE = Distributed('ops', 'posthog_test', 'sharded_query_log_archive_v3')- '''-# ---# name: test_create_table_query[query_log_archive_v3_buffer]'''CREATE TABLE IF NOT EXISTS query_log_archive_v3_buffer (@@ -8888,181 +8612,6 @@'''# ----# name: test_create_table_query[sharded_query_log_archive]- '''- CREATE TABLE IF NOT EXISTS sharded_query_log_archive (-- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart' = 1, 'QueryFinish' = 2, 'ExceptionBeforeStart' = 3, 'ExceptionWhileProcessing' = 4),-- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,-- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,-- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),-- exception_code Int32,- exception String,- stack_trace String,-- team_id Int64,- log_comment JSON(- max_dynamic_paths = 256,- team_id Int64,- user_id Int64,- org_id String,- session_id String,- access_method LowCardinality(String),- api_key_label String,- api_key_mask String,- workflow LowCardinality(String),- kind LowCardinality(String),- id String,- route_id String,- query_type LowCardinality(String),- product LowCardinality(String),- chargeable Bool,- name String,- request_name String,- client_query_id String,- is_impersonated Bool,- dashboard_id Int64,- insight_id Int64,- cohort_id Int64,- batch_export_id String,- experiment_id Int64,- experiment_feature_flag_key String,- alert_config_id String,- feature LowCardinality(String),- table_id String,- warehouse_query Bool,- person_on_events_mode LowCardinality(String),- service_name String,- workload LowCardinality(String),- `temporal.workflow_namespace` String,- `temporal.workflow_type` String,- `temporal.workflow_id` String,- `temporal.workflow_run_id` String,- `temporal.activity_type` String,- `temporal.activity_id` String,- `temporal.attempt` Int64,- `dagster.job_name` String,- `dagster.run_id` String,- `dagster.tags.owner` String,- SKIP user_email,- SKIP query_settings,- SKIP timings,- SKIP `filter`,- SKIP hogql_features,- SKIP http_referer,- SKIP http_user_agent,- SKIP http_request_id,- SKIP cache_key- ),- ProfileEvents Map(String, UInt64),-- exception_name String ALIAS errorCodeToName(exception_code),-- ProfileEvents_RealTimeMicroseconds Int64 ALIAS ProfileEvents['RealTimeMicroseconds'],- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64 ALIAS ProfileEvents['OSCPUVirtualTimeMicroseconds'],- ProfileEvents_S3Clients Int64 ALIAS ProfileEvents['S3Clients'],- ProfileEvents_S3DeleteObjects Int64 ALIAS ProfileEvents['S3DeleteObjects'],- ProfileEvents_S3CopyObject Int64 ALIAS ProfileEvents['S3CopyObject'],- ProfileEvents_S3ListObjects Int64 ALIAS ProfileEvents['S3ListObjects'],- ProfileEvents_S3HeadObject Int64 ALIAS ProfileEvents['S3HeadObject'],- ProfileEvents_S3GetObjectAttributes Int64 ALIAS ProfileEvents['S3GetObjectAttributes'],- ProfileEvents_S3CreateMultipartUpload Int64 ALIAS ProfileEvents['S3CreateMultipartUpload'],- ProfileEvents_S3UploadPartCopy Int64 ALIAS ProfileEvents['S3UploadPartCopy'],- ProfileEvents_S3UploadPart Int64 ALIAS ProfileEvents['S3UploadPart'],- ProfileEvents_S3AbortMultipartUpload Int64 ALIAS ProfileEvents['S3AbortMultipartUpload'],- ProfileEvents_S3CompleteMultipartUpload Int64 ALIAS ProfileEvents['S3CompleteMultipartUpload'],- ProfileEvents_S3PutObject Int64 ALIAS ProfileEvents['S3PutObject'],- ProfileEvents_S3GetObject Int64 ALIAS ProfileEvents['S3GetObject'],- ProfileEvents_ReadBufferFromS3Bytes Int64 ALIAS ProfileEvents['ReadBufferFromS3Bytes'],- ProfileEvents_WriteBufferFromS3Bytes Int64 ALIAS ProfileEvents['WriteBufferFromS3Bytes'],-- lc_workflow LowCardinality(String) ALIAS log_comment.workflow,- lc_kind LowCardinality(String) ALIAS log_comment.kind,- lc_id String ALIAS log_comment.id::String,- lc_route_id String ALIAS log_comment.route_id::String,- lc_access_method LowCardinality(String) ALIAS log_comment.access_method,- lc_api_key_label String ALIAS log_comment.api_key_label::String,- lc_api_key_mask String ALIAS log_comment.api_key_mask::String,- lc_query_type LowCardinality(String) ALIAS log_comment.query_type,- lc_product LowCardinality(String) ALIAS log_comment.product,- lc_chargeable Bool ALIAS log_comment.chargeable,- lc_name String ALIAS log_comment.name::String,- lc_request_name String ALIAS log_comment.request_name::String,- lc_client_query_id String ALIAS log_comment.client_query_id::String,- lc_org_id String ALIAS log_comment.org_id::String,- lc_user_id Int64 ALIAS log_comment.user_id,- lc_is_impersonated Bool ALIAS log_comment.is_impersonated,- lc_session_id String ALIAS log_comment.session_id::String,- lc_dashboard_id Int64 ALIAS log_comment.dashboard_id,- lc_insight_id Int64 ALIAS log_comment.insight_id,- lc_cohort_id Int64 ALIAS log_comment.cohort_id,- lc_batch_export_id String ALIAS log_comment.batch_export_id::String,- lc_experiment_id Int64 ALIAS log_comment.experiment_id,- lc_experiment_feature_flag_key String ALIAS log_comment.experiment_feature_flag_key::String,- lc_alert_config_id String ALIAS log_comment.alert_config_id::String,- lc_feature LowCardinality(String) ALIAS log_comment.feature,- lc_table_id String ALIAS log_comment.table_id::String,- lc_warehouse_query Bool ALIAS log_comment.warehouse_query,- lc_person_on_events_mode LowCardinality(String) ALIAS log_comment.person_on_events_mode,- lc_service_name String ALIAS log_comment.service_name::String,- lc_workload LowCardinality(String) ALIAS log_comment.workload,-- lc_query__kind LowCardinality(String) ALIAS if(JSONHas(toString(log_comment), 'query', 'source'),- JSONExtractString(toString(log_comment), 'query', 'source', 'kind'),- JSONExtractString(toString(log_comment), 'query', 'kind')),- lc_query__query String ALIAS multiIf(not is_initial_query, '',- JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'),- JSONExtractString(toString(log_comment), 'query', 'query')),- lc_query String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), ''),-- lc_temporal__workflow_namespace String ALIAS log_comment.`temporal.workflow_namespace`::String,- lc_temporal__workflow_type String ALIAS log_comment.`temporal.workflow_type`::String,- lc_temporal__workflow_id String ALIAS log_comment.`temporal.workflow_id`::String,- lc_temporal__workflow_run_id String ALIAS log_comment.`temporal.workflow_run_id`::String,- lc_temporal__activity_type String ALIAS log_comment.`temporal.activity_type`::String,- lc_temporal__activity_id String ALIAS log_comment.`temporal.activity_id`::String,- lc_temporal__attempt Int64 ALIAS log_comment.`temporal.attempt`,-- lc_dagster__job_name String ALIAS log_comment.`dagster.job_name`::String,- lc_dagster__run_id String ALIAS log_comment.`dagster.run_id`::String,- lc_dagster__owner String ALIAS log_comment.`dagster.tags.owner`::String,-- lc_modifiers String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), ''),-- lc_plan_fingerprint String ALIAS ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), ''),- lc_estimated_rows Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0),- lc_estimated_bytes Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0)- ) ENGINE = ReplicatedMergeTree('/clickhouse/tables/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e_noshard/posthog.sharded_query_log_archive', '{replica}-{shard}')- PARTITION BY toYYYYMM(event_date)- ORDER BY (team_id, event_date, event_time, query_id)- PRIMARY KEY (team_id, event_date, event_time, query_id) SETTINGS object_shared_data_serialization_version='map_with_buckets',object_serialization_version='v3'- '''-# ---# name: test_create_table_query[sharded_query_log_archive_v3]'''CREATE TABLE IF NOT EXISTS sharded_query_log_archive_v3 (@@ -11584,101 +11133,6 @@'''# ----# name: test_create_table_query[writable_query_log_archive]- '''- CREATE TABLE IF NOT EXISTS writable_query_log_archive (-- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart' = 1, 'QueryFinish' = 2, 'ExceptionBeforeStart' = 3, 'ExceptionWhileProcessing' = 4),-- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,-- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,-- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),-- exception_code Int32,- exception String,- stack_trace String,-- team_id Int64,- log_comment JSON(- max_dynamic_paths = 256,- team_id Int64,- user_id Int64,- org_id String,- session_id String,- access_method LowCardinality(String),- api_key_label String,- api_key_mask String,- workflow LowCardinality(String),- kind LowCardinality(String),- id String,- route_id String,- query_type LowCardinality(String),- product LowCardinality(String),- chargeable Bool,- name String,- request_name String,- client_query_id String,- is_impersonated Bool,- dashboard_id Int64,- insight_id Int64,- cohort_id Int64,- batch_export_id String,- experiment_id Int64,- experiment_feature_flag_key String,- alert_config_id String,- feature LowCardinality(String),- table_id String,- warehouse_query Bool,- person_on_events_mode LowCardinality(String),- service_name String,- workload LowCardinality(String),- `temporal.workflow_namespace` String,- `temporal.workflow_type` String,- `temporal.workflow_id` String,- `temporal.workflow_run_id` String,- `temporal.activity_type` String,- `temporal.activity_id` String,- `temporal.attempt` Int64,- `dagster.job_name` String,- `dagster.run_id` String,- `dagster.tags.owner` String,- SKIP user_email,- SKIP query_settings,- SKIP timings,- SKIP `filter`,- SKIP hogql_features,- SKIP http_referer,- SKIP http_user_agent,- SKIP http_request_id,- SKIP cache_key- ),- ProfileEvents Map(String, UInt64)- ) ENGINE = Distributed('ops', 'posthog_test', 'query_log_archive_buffer')- '''-# ---# name: test_create_table_query[writable_query_log_archive_v3]'''CREATE TABLE IF NOT EXISTS writable_query_log_archive_v3 (@@ -13823,101 +13277,6 @@'''# ----# name: test_create_table_query_replicated_and_storage[query_log_archive_buffer]- '''- CREATE TABLE IF NOT EXISTS query_log_archive_buffer (-- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart' = 1, 'QueryFinish' = 2, 'ExceptionBeforeStart' = 3, 'ExceptionWhileProcessing' = 4),-- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,-- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,-- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),-- exception_code Int32,- exception String,- stack_trace String,-- team_id Int64,- log_comment JSON(- max_dynamic_paths = 256,- team_id Int64,- user_id Int64,- org_id String,- session_id String,- access_method LowCardinality(String),- api_key_label String,- api_key_mask String,- workflow LowCardinality(String),- kind LowCardinality(String),- id String,- route_id String,- query_type LowCardinality(String),- product LowCardinality(String),- chargeable Bool,- name String,- request_name String,- client_query_id String,- is_impersonated Bool,- dashboard_id Int64,- insight_id Int64,- cohort_id Int64,- batch_export_id String,- experiment_id Int64,- experiment_feature_flag_key String,- alert_config_id String,- feature LowCardinality(String),- table_id String,- warehouse_query Bool,- person_on_events_mode LowCardinality(String),- service_name String,- workload LowCardinality(String),- `temporal.workflow_namespace` String,- `temporal.workflow_type` String,- `temporal.workflow_id` String,- `temporal.workflow_run_id` String,- `temporal.activity_type` String,- `temporal.activity_id` String,- `temporal.attempt` Int64,- `dagster.job_name` String,- `dagster.run_id` String,- `dagster.tags.owner` String,- SKIP user_email,- SKIP query_settings,- SKIP timings,- SKIP `filter`,- SKIP hogql_features,- SKIP http_referer,- SKIP http_user_agent,- SKIP http_request_id,- SKIP cache_key- ),- ProfileEvents Map(String, UInt64)- ) ENGINE = Buffer('posthog_test', 'sharded_query_log_archive', 16, 10, 60, 10000, 1000000, 10000000, 100000000)- '''-# ---# name: test_create_table_query_replicated_and_storage[query_log_archive_v3_buffer]'''CREATE TABLE IF NOT EXISTS query_log_archive_v3_buffer (@@ -15103,181 +14462,6 @@'''# ----# name: test_create_table_query_replicated_and_storage[sharded_query_log_archive]- '''- CREATE TABLE IF NOT EXISTS sharded_query_log_archive (-- hostname LowCardinality(String),- user LowCardinality(String),- query_id String,- initial_query_id String,- is_initial_query UInt8,- type Enum8('QueryStart' = 1, 'QueryFinish' = 2, 'ExceptionBeforeStart' = 3, 'ExceptionWhileProcessing' = 4),-- event_date Date,- event_time DateTime,- event_time_microseconds DateTime64(6),- query_start_time DateTime,- query_start_time_microseconds DateTime64(6),- query_duration_ms UInt64,-- read_rows UInt64,- read_bytes UInt64,- written_rows UInt64,- written_bytes UInt64,- result_rows UInt64,- result_bytes UInt64,- memory_usage UInt64,- peak_threads_usage UInt64,-- current_database LowCardinality(String),- query String,- formatted_query String,- normalized_query_hash UInt64,- query_kind LowCardinality(String),-- exception_code Int32,- exception String,- stack_trace String,-- team_id Int64,- log_comment JSON(- max_dynamic_paths = 256,- team_id Int64,- user_id Int64,- org_id String,- session_id String,- access_method LowCardinality(String),- api_key_label String,- api_key_mask String,- workflow LowCardinality(String),- kind LowCardinality(String),- id String,- route_id String,- query_type LowCardinality(String),- product LowCardinality(String),- chargeable Bool,- name String,- request_name String,- client_query_id String,- is_impersonated Bool,- dashboard_id Int64,- insight_id Int64,- cohort_id Int64,- batch_export_id String,- experiment_id Int64,- experiment_feature_flag_key String,- alert_config_id String,- feature LowCardinality(String),- table_id String,- warehouse_query Bool,- person_on_events_mode LowCardinality(String),- service_name String,- workload LowCardinality(String),- `temporal.workflow_namespace` String,- `temporal.workflow_type` String,- `temporal.workflow_id` String,- `temporal.workflow_run_id` String,- `temporal.activity_type` String,- `temporal.activity_id` String,- `temporal.attempt` Int64,- `dagster.job_name` String,- `dagster.run_id` String,- `dagster.tags.owner` String,- SKIP user_email,- SKIP query_settings,- SKIP timings,- SKIP `filter`,- SKIP hogql_features,- SKIP http_referer,- SKIP http_user_agent,- SKIP http_request_id,- SKIP cache_key- ),- ProfileEvents Map(String, UInt64),-- exception_name String ALIAS errorCodeToName(exception_code),-- ProfileEvents_RealTimeMicroseconds Int64 ALIAS ProfileEvents['RealTimeMicroseconds'],- ProfileEvents_OSCPUVirtualTimeMicroseconds Int64 ALIAS ProfileEvents['OSCPUVirtualTimeMicroseconds'],- ProfileEvents_S3Clients Int64 ALIAS ProfileEvents['S3Clients'],- ProfileEvents_S3DeleteObjects Int64 ALIAS ProfileEvents['S3DeleteObjects'],- ProfileEvents_S3CopyObject Int64 ALIAS ProfileEvents['S3CopyObject'],- ProfileEvents_S3ListObjects Int64 ALIAS ProfileEvents['S3ListObjects'],- ProfileEvents_S3HeadObject Int64 ALIAS ProfileEvents['S3HeadObject'],- ProfileEvents_S3GetObjectAttributes Int64 ALIAS ProfileEvents['S3GetObjectAttributes'],- ProfileEvents_S3CreateMultipartUpload Int64 ALIAS ProfileEvents['S3CreateMultipartUpload'],- ProfileEvents_S3UploadPartCopy Int64 ALIAS ProfileEvents['S3UploadPartCopy'],- ProfileEvents_S3UploadPart Int64 ALIAS ProfileEvents['S3UploadPart'],- ProfileEvents_S3AbortMultipartUpload Int64 ALIAS ProfileEvents['S3AbortMultipartUpload'],- ProfileEvents_S3CompleteMultipartUpload Int64 ALIAS ProfileEvents['S3CompleteMultipartUpload'],- ProfileEvents_S3PutObject Int64 ALIAS ProfileEvents['S3PutObject'],- ProfileEvents_S3GetObject Int64 ALIAS ProfileEvents['S3GetObject'],- ProfileEvents_ReadBufferFromS3Bytes Int64 ALIAS ProfileEvents['ReadBufferFromS3Bytes'],- ProfileEvents_WriteBufferFromS3Bytes Int64 ALIAS ProfileEvents['WriteBufferFromS3Bytes'],-- lc_workflow LowCardinality(String) ALIAS log_comment.workflow,- lc_kind LowCardinality(String) ALIAS log_comment.kind,- lc_id String ALIAS log_comment.id::String,- lc_route_id String ALIAS log_comment.route_id::String,- lc_access_method LowCardinality(String) ALIAS log_comment.access_method,- lc_api_key_label String ALIAS log_comment.api_key_label::String,- lc_api_key_mask String ALIAS log_comment.api_key_mask::String,- lc_query_type LowCardinality(String) ALIAS log_comment.query_type,- lc_product LowCardinality(String) ALIAS log_comment.product,- lc_chargeable Bool ALIAS log_comment.chargeable,- lc_name String ALIAS log_comment.name::String,- lc_request_name String ALIAS log_comment.request_name::String,- lc_client_query_id String ALIAS log_comment.client_query_id::String,- lc_org_id String ALIAS log_comment.org_id::String,- lc_user_id Int64 ALIAS log_comment.user_id,- lc_is_impersonated Bool ALIAS log_comment.is_impersonated,- lc_session_id String ALIAS log_comment.session_id::String,- lc_dashboard_id Int64 ALIAS log_comment.dashboard_id,- lc_insight_id Int64 ALIAS log_comment.insight_id,- lc_cohort_id Int64 ALIAS log_comment.cohort_id,- lc_batch_export_id String ALIAS log_comment.batch_export_id::String,- lc_experiment_id Int64 ALIAS log_comment.experiment_id,- lc_experiment_feature_flag_key String ALIAS log_comment.experiment_feature_flag_key::String,- lc_alert_config_id String ALIAS log_comment.alert_config_id::String,- lc_feature LowCardinality(String) ALIAS log_comment.feature,- lc_table_id String ALIAS log_comment.table_id::String,- lc_warehouse_query Bool ALIAS log_comment.warehouse_query,- lc_person_on_events_mode LowCardinality(String) ALIAS log_comment.person_on_events_mode,- lc_service_name String ALIAS log_comment.service_name::String,- lc_workload LowCardinality(String) ALIAS log_comment.workload,-- lc_query__kind LowCardinality(String) ALIAS if(JSONHas(toString(log_comment), 'query', 'source'),- JSONExtractString(toString(log_comment), 'query', 'source', 'kind'),- JSONExtractString(toString(log_comment), 'query', 'kind')),- lc_query__query String ALIAS multiIf(not is_initial_query, '',- JSONHas(toString(log_comment), 'query', 'source'), JSONExtractString(toString(log_comment), 'query', 'source', 'query'),- JSONExtractString(toString(log_comment), 'query', 'query')),- lc_query String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'query'), ''),-- lc_temporal__workflow_namespace String ALIAS log_comment.`temporal.workflow_namespace`::String,- lc_temporal__workflow_type String ALIAS log_comment.`temporal.workflow_type`::String,- lc_temporal__workflow_id String ALIAS log_comment.`temporal.workflow_id`::String,- lc_temporal__workflow_run_id String ALIAS log_comment.`temporal.workflow_run_id`::String,- lc_temporal__activity_type String ALIAS log_comment.`temporal.activity_type`::String,- lc_temporal__activity_id String ALIAS log_comment.`temporal.activity_id`::String,- lc_temporal__attempt Int64 ALIAS log_comment.`temporal.attempt`,-- lc_dagster__job_name String ALIAS log_comment.`dagster.job_name`::String,- lc_dagster__run_id String ALIAS log_comment.`dagster.run_id`::String,- lc_dagster__owner String ALIAS log_comment.`dagster.tags.owner`::String,-- lc_modifiers String ALIAS if(is_initial_query, JSONExtractRaw(toString(log_comment), 'modifiers'), ''),-- lc_plan_fingerprint String ALIAS ifNull(dynamicElement(log_comment.plan_fingerprint, 'String'), ''),- lc_estimated_rows Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_rows, 'Int64'), 0),- lc_estimated_bytes Int64 ALIAS ifNull(dynamicElement(log_comment.estimated_bytes, 'Int64'), 0)- ) ENGINE = ReplicatedMergeTree('/clickhouse/tables/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e_noshard/posthog.sharded_query_log_archive', '{replica}-{shard}')- PARTITION BY toYYYYMM(event_date)- ORDER BY (team_id, event_date, event_time, query_id)- PRIMARY KEY (team_id, event_date, event_time, query_id) SETTINGS object_shared_data_serialization_version='map_with_buckets',object_serialization_version='v3'- '''-# ---# name: test_create_table_query_replicated_and_storage[sharded_query_log_archive_v3]'''CREATE TABLE IF NOT EXISTS sharded_query_log_archive_v3 (diff --git a/posthog/clickhouse/test/test_query_log_archive_aliases.py b/posthog/clickhouse/test/test_query_log_archive_aliases.pydeleted file mode 100644index 1564235b8cf3..000000000000--- a/posthog/clickhouse/test/test_query_log_archive_aliases.py+++ /dev/null@@ -1,85 +0,0 @@-import json--from posthog.test.base import ClickhouseTestMixin--from django.test import SimpleTestCase--from parameterized import parameterized--from posthog.hogql.context import HogQLContext-from posthog.hogql.database.schema.query_log_archive import RawQueryLogArchiveTable--from posthog.clickhouse.client import sync_execute-from posthog.clickhouse.query_log_archive import QUERY_LOG_ARCHIVE_OPS_TABLE_SQL--TABLE = "test_query_log_archive_aliases"---class TestQueryLogArchiveCostPlannerAliases(ClickhouseTestMixin, SimpleTestCase):- @classmethod- def setUpClass(cls) -> None:- super().setUpClass()- sync_execute(f"DROP TABLE IF EXISTS {TABLE} SYNC")- sync_execute(- QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(table_name=TABLE, engine="MergeTree", include_table_clauses=False)- + " ORDER BY (team_id, event_date)"- )-- @classmethod- def tearDownClass(cls) -> None:- try:- sync_execute(f"DROP TABLE IF EXISTS {TABLE} SYNC")- finally:- super().tearDownClass()-- def _insert(self, query_id: str, log_comment: dict) -> None:- sync_execute(- f"INSERT INTO {TABLE} (query_id, type, event_date, event_time, team_id, log_comment) "- "VALUES (%(query_id)s, 'QueryFinish', today(), now(), %(team_id)s, %(log_comment)s)",- {"query_id": query_id, "team_id": log_comment["team_id"], "log_comment": json.dumps(log_comment)},- )-- def _read(self, query_id: str) -> tuple[str, int, int]:- [row] = sync_execute(- f"SELECT lc_plan_fingerprint, lc_estimated_rows, lc_estimated_bytes FROM {TABLE} WHERE query_id = %(q)s",- {"q": query_id},- )- return row-- @parameterized.expand(- [- (- "present",- {- "team_id": 1,- "plan_fingerprint": "e8ff93df7e4e989a",- "estimated_rows": 1_800_000,- "estimated_bytes": 9_000,- },- ("e8ff93df7e4e989a", 1_800_000, 9_000),- ),- ("absent", {"team_id": 1, "query_type": "HogQLQuery"}, ("", 0, 0)),- (- "large_int_stays_int64",- {"team_id": 1, "plan_fingerprint": "ab", "estimated_rows": 1_800_000_000_000, "estimated_bytes": 0},- ("ab", 1_800_000_000_000, 0),- ),- ]- )- def test_aliases_read_the_tag_values_back(self, name, log_comment, expected):- self._insert(name, log_comment)-- assert self._read(name) == expected-- @parameterized.expand([("private", True, False), ("ordinary", False, True), ("missing", None, True)])- def test_hogql_excludes_only_private_scout_queries(self, name: str, marker: bool | None, visible: bool) -> None:- log_comment: dict[str, object] = {"team_id": 2}- if marker is not None:- log_comment["is_scout_experiment"] = marker- self._insert(name, log_comment)- table = RawQueryLogArchiveTable().to_printed_clickhouse_table_ref(HogQLContext(team_id=2))- table = table.replace("FROM query_log_archive ", f"FROM {TABLE} ")-- rows = sync_execute(f"SELECT query_id FROM {table} WHERE query_id = %(query_id)s", {"query_id": name})-- assert rows == ([(name,)] if visible else [])diff --git a/posthog/test/base.py b/posthog/test/base.pyindex 04f11c42827f..f05be13f4aa3 100644--- a/posthog/test/base.py+++ b/posthog/test/base.py@@ -73,15 +73,9 @@ from posthog.clickhouse.preaggregation.sql import ()from posthog.clickhouse.query_log_archive import (DISTRIBUTED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,- DISTRIBUTED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL,- QUERY_LOG_ARCHIVE_OPS_MV,- QUERY_LOG_ARCHIVE_OPS_MV_SQL,QUERY_LOG_ARCHIVE_V3_BUFFER_TABLE_SQL,QUERY_LOG_ARCHIVE_V3_MV_SQL,- SHARDED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,SHARDED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL,- WRITABLE_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL,- WRITABLE_QUERY_LOG_ARCHIVE_TABLE,WRITABLE_QUERY_LOG_ARCHIVE_V3_TABLE_SQL,)from posthog.cloud_utils import TEST_clear_instance_license_cache@@ -2227,7 +2221,6 @@ def reset_clickhouse_database() -> None:WEB_STATS_SQL(table_name="web_pre_aggregated_stats_staging"),WEB_BOUNCES_SQL(table_name="web_pre_aggregated_bounces_staging"),WEB_PRE_AGGREGATED_TEAM_SELECTION_TABLE_SQL(),- SHARDED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(),SHARDED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL(),QUERY_LOG_ARCHIVE_V3_BUFFER_TABLE_SQL(),COHORT_MEMBERSHIP_TABLE_SQL(),@@ -2253,8 +2246,6 @@ def reset_clickhouse_database() -> None:CUSTOM_METRICS_REPLICATION_QUEUE_VIEW(),WEB_PRE_AGGREGATED_TEAM_SELECTION_DICTIONARY_SQL(),DISTRIBUTED_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(),- WRITABLE_QUERY_LOG_ARCHIVE_OPS_TABLE_SQL(),- DISTRIBUTED_QUERY_LOG_ARCHIVE_V3_TABLE_SQL(),WRITABLE_QUERY_LOG_ARCHIVE_V3_TABLE_SQL(),COHORT_MEMBERSHIP_WRITABLE_TABLE_SQL(),KAFKA_COHORT_MEMBERSHIP_TABLE_SQL(),@@ -2284,9 +2275,6 @@ def reset_clickhouse_database() -> None:COHORT_MEMBERSHIP_MV_SQL(),PRECALCULATED_EVENTS_MV_SQL(),PRECALCULATED_PERSON_PROPERTIES_MV_SQL(),- QUERY_LOG_ARCHIVE_OPS_MV_SQL(- view_name=QUERY_LOG_ARCHIVE_OPS_MV, dest_table=WRITABLE_QUERY_LOG_ARCHIVE_TABLE- ),QUERY_LOG_ARCHIVE_V3_MV_SQL(),])