Skip to content

Commit

Permalink
Add flattened statistics history
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Dec 16, 2024
1 parent ea93840 commit 43f6ab6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion sql.d/schema/create_schema_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,11 @@ DROP TABLE IF EXISTS statistics_history CASCADE;

CREATE TABLE statistics_history (
ts timestamp with time zone NOT NULL PRIMARY KEY,
snapshot jsonb NOT NULL
snapshot jsonb NOT NULL,
num_packages integer,
num_projects integer,
num_problems integer,
num_maintainers integer
);

--------------------------------------------------------------------------------
Expand Down
12 changes: 10 additions & 2 deletions sql.d/update/update_histories.sql
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,19 @@ WHERE state != 'legacy';
-- global statistics
INSERT INTO statistics_history (
ts,
snapshot
snapshot,
num_packages,
num_projects,
num_problems,
num_maintainers
)
SELECT
now(),
to_jsonb(snapshot)
to_jsonb(snapshot),
snapshot.num_packages,
snapshot.num_metapackages,
snapshot.num_problems,
snapshot.num_maintainers
FROM (
SELECT
*
Expand Down

0 comments on commit 43f6ab6

Please sign in to comment.