]> git.xonotic.org Git - xonotic/xonstatdb.git/blobdiff - scripts/gen_partitions.shl
Add an Elo indicator for turning off processing at the server scope.
[xonotic/xonstatdb.git] / scripts / gen_partitions.shl
index 963f829cdc2bd9d27d01aa9009d42f8da43e10db..1b68000f933229ddd7c3e68f134ee984b5dd7933 100755 (executable)
@@ -30,11 +30,24 @@ do
         printf "CREATE INDEX %s_%s%s_ix001 on %s_%s%s(create_dt);\n" $table $year $qtr $table $year $qtr
 
         # conditional indexes that depend on the table
+        if [[ $table = "games" ]]
+        then
+            printf "CREATE INDEX %s_%s%s_ix002 on %s_%s%s using gin(players);\n" $table $year $qtr $table $year $qtr
+            printf "CREATE UNIQUE INDEX %s_%s%s_pk on %s_%s%s(game_id);\n" $table $year $qtr $table $year $qtr
+            printf "ALTER TABLE %s_%s%s ADD PRIMARY KEY USING INDEX %s_%s%s_pk;\n" $table $year $qtr $table $year $qtr
+        fi
+        
         if [[ $table = "player_game_stats" || $table = "player_weapon_stats" ]]
         then
             printf "CREATE INDEX %s_%s%s_ix002 on %s_%s%s(game_id);\n" $table $year $qtr $table $year $qtr
             printf "CREATE INDEX %s_%s%s_ix003 on %s_%s%s(player_id);\n" $table $year $qtr $table $year $qtr
         fi
+
+        if [[ $table = "team_game_stats" ]]
+        then
+            printf "CREATE INDEX %s_%s%s_ix002 on %s_%s%s(game_id);\n" $table $year $qtr $table $year $qtr
+        fi
+
         printf "\n"
     done
 done