From d76f203c9feb17d51d30dae7489a734f95385f3e Mon Sep 17 00:00:00 2001
From: Kevin Fenzi <kevin@scrye.com>
Date: Dec 07 2025 17:03:58 +0000
Subject: various database updates


Signed-off-by: Kevin Fenzi <kevin@scrye.com>

---

diff --git a/modules/sysadmin_guide/pages/database.adoc b/modules/sysadmin_guide/pages/database.adoc
index 10ebce4..a0f3ef4 100644
--- a/modules/sysadmin_guide/pages/database.adoc
+++ b/modules/sysadmin_guide/pages/database.adoc
@@ -28,18 +28,16 @@ Contact::
 Location::
   rdu3
 Servers::
-  sb01, db03, db-fas01, db-datanommer02, db-koji01, db-s390-koji01,
-  db-arm-koji01, db-ppc-koji01, db-qa01, dbqastg01
+  db01, db03, db-fas01, db-datanommer02, db-koji01, db-riscv-koji01, db-openqa01
 Purpose::
   Provides database connection to many of our apps.
 
 == Description
 
 _db01_, _db03_ and _db-fas01_ are our primary servers. _db01_ and _db-fas01_ run
-_PostgreSQL_. _db03_ contain _mariadb_. _db-koji01_, _db-s390-koji01_,
-_db-arm-koji01_, _db-ppc-koji01_ contain secondary _kojis_. _db-qa01_ and
-_db-qastg01_ contain _resultsdb_. _db-datanommer02_ contains all storage
-messages from _postgresql_ database.
+_PostgreSQL_. _db03_ contain _mariadb_. _db-koji01_, _db-riscv-koji01_,
+contain _kojis_. _db-qa01_ and _db-openqa01 contain _openqa.
+_db-datanommer02_ contains all fedora messaging messages.
 
 == Creating a New Postgresql Database
 
@@ -100,7 +98,7 @@ to incorporate it into the config file. See fas.pp for an example.
 === Connection issues
 
 There are no known outstanding issues with the database itself. Remember
-that every time either database is restarted, services will have to be
+that every time either database is restarted, services may have to be
 restarted (see <<_restart_procedure>>).
 
 === Some useful queries
@@ -123,6 +121,12 @@ select datname, count(datname) from pg_stat_activity group by datname
 order by count desc;
 ....
 
+print sizes of tables in currently connected database:
+
+....
+select table_name, pg_size_pretty(pg_total_relation_size(quote_ident(table_name))), pg_total_relation_size(quote_ident(table_name)) from information_schema.tables where table_schema = 'public' order by 3 desc;
+....
+
 ==== Seeing how "dirty" a table is
 
 We've added a function from postgres's contrib directory to tell how
@@ -149,18 +153,6 @@ free_percent       | 82.73
 Vacuum should clear out dead_tuples. Only a vacuum full, which will lock
 the table and therefore should be avoided, will clear out free space.
 
-==== XID Wraparound
-
-Find out how close we are to having to perform a vacuum of a database
-(as opposed to individual tables of the db). We should schedule a vacuum
-when about 50% of the transaction ids have been used (approximately
-530,000,000 xids):
-
-....
-select datname, age(datfrozenxid), pow(2, 31) - age(datfrozenxid) as xids_remaining
-from pg_database order by xids_remaining;
-....
-
 == Restart Procedure
 
 If the database server needs to be restarted it should come back on its
@@ -171,31 +163,12 @@ service mysqld restart
 service postgresql restart
 ....
 
-=== Koji
-
-Any time postgreql is restarted, koji needs to be restarted. Please also
-see <<koji.adoc#_restarting_koji,Restarting Koji>>.
-
-=== Bodhi
-
-Anytime postgresql is restarted Bodhi will need to be restarted no sop
-currently exists for this.
-
-== TurboGears and MySQL
-
-[NOTE]
-====
-About TurboGears and MySQL
-
-There's a known bug in TurboGears that causes MySQL clients not to
-automatically reconnect when lost. Typically a restart of the TurboGears
-application will correct this issue.
-====
-
 == Restoring from backups or specific dbs.
 
 Our backups store the latest copy in `/backups/` on each db server. These
 backups are created automatically by the db-backup script run fron cron.
+These backups are synced daily to backup01. If you need a backup from
+a while ago or the host is no longer available, they will be there.
 Look in `/usr/local/bin` for the backup script.
 
 To restore partially or completely you need to:
@@ -219,3 +192,9 @@ edit up _global.sql_ to only create/alter the dbs you care about
 `createdb $dbname pg_restore -d dbname dbname_backup_file.db`
 +
 . restart postgres and check your data.
+
+== modules and versioning
+
+In the case of some servers we are using a postgresql module in rhel
+in order to run a newer version. Check the /etc/dnf/modules.d/postgresql.module
+file to determine what stream is active.

