]> git.xonotic.org Git - xonotic/xonstatdb.git/commitdiff
Add support for summary statistics.
authorAnt Zucaro <azucaro@gmail.com>
Sat, 15 Dec 2012 14:44:06 +0000 (09:44 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Sat, 15 Dec 2012 14:44:06 +0000 (09:44 -0500)
The summary statistics table is very small, and is intended
to be populated via cron to avoid any lag in the actual webapp
when scanning all of the rows in players, games, and servers.
Even caching such a query would yield bad performance during
invalidation, so I've opted to make this table be populated with
an offline script similar to the one for ranks.

tables/summary_stats.tab [new file with mode: 0755]

diff --git a/tables/summary_stats.tab b/tables/summary_stats.tab
new file mode 100755 (executable)
index 0000000..8e20da9
--- /dev/null
@@ -0,0 +1,15 @@
+CREATE TABLE xonstat.summary_stats
+(
+  total_players bigint NOT NULL,
+  total_servers bigint NOT NULL,
+  total_games bigint NOT NULL,
+  total_dm_games bigint NOT NULL,
+  total_duel_games bigint NOT NULL,
+  total_ctf_games bigint NOT NULL,
+  create_dt timestamp without time zone NOT NULL DEFAULT (current_timestamp at time zone 'UTC')
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE xonstat.summary_stats OWNER TO xonstat;