You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/priv/data_migrations/VersionedSessions/sql/create-sessions-tmp-table.s...

14 lines
551 B
Plaintext

CREATE TABLE sessions_v2_tmp_versioned
<%= if @cluster? do %>ON CLUSTER '{cluster}'<% end %>
AS sessions_v2
<%= if @cluster? do %>
ENGINE = ReplicatedVersionedCollapsingMergeTree('/clickhouse/{cluster}/tables/{shard}/plausible_prod/sessions_v2_<%= @unique_suffix %>', '{replica}', sign, events)
<% else %>
ENGINE = VersionedCollapsingMergeTree(sign, events)
<% end %>
PARTITION BY toYYYYMM(start)
PRIMARY KEY (site_id, toDate(start), user_id, session_id)
ORDER BY (site_id, toDate(start), user_id, session_id)
SAMPLE BY user_id
<%= @table_settings %>