Optimize analytics queries (#781)

* Optimize analytics queries

* fix clippy
This commit is contained in:
Geometrically
2023-12-04 18:49:51 -07:00
committed by GitHub
parent 27055b96e3
commit 4630d175d7
11 changed files with 83 additions and 1095 deletions

View File

@@ -36,7 +36,6 @@ pub async fn init_client_with_database(
"
CREATE TABLE IF NOT EXISTS {database}.views
(
id UUID,
recorded DateTime64(4),
domain String,
site_path String,
@@ -50,7 +49,7 @@ pub async fn init_client_with_database(
headers Array(Tuple(String, String)),
)
ENGINE = MergeTree()
PRIMARY KEY (id, recorded)
PRIMARY KEY (project_id, recorded)
"
))
.execute()
@@ -61,7 +60,6 @@ pub async fn init_client_with_database(
"
CREATE TABLE IF NOT EXISTS {database}.downloads
(
id UUID,
recorded DateTime64(4),
domain String,
site_path String,
@@ -76,7 +74,7 @@ pub async fn init_client_with_database(
headers Array(Tuple(String, String)),
)
ENGINE = MergeTree()
PRIMARY KEY (id, recorded)
PRIMARY KEY (project_id, recorded)
"
))
.execute()
@@ -87,7 +85,6 @@ pub async fn init_client_with_database(
"
CREATE TABLE IF NOT EXISTS {database}.playtime
(
id UUID,
recorded DateTime64(4),
seconds UInt64,
@@ -100,7 +97,7 @@ pub async fn init_client_with_database(
parent UInt64,
)
ENGINE = MergeTree()
PRIMARY KEY (id, recorded)
PRIMARY KEY (project_id, recorded)
"
))
.execute()