Add maitenance queries

main
mathan 2024-02-19 11:22:51 -08:00
parent 4ef6abbfc4
commit 95c24ff0c5
2 changed files with 14 additions and 1 deletions

View File

@ -1 +1 @@
# See Makefile
# See Makefile and maitenance.md

View File

@ -33,6 +33,19 @@ Seen repos
Fully indexed repos
`select count(*) from repos where last_indexed_rev <> '' and (last_indexed_rev >= first_rev_since_reset or first_rev_since_reset is null or first_rev_since_reset = '');`
Count all records
`analyze records; select relname, reltuples::int from pg_class where relname like 'records';`
View errors
`select last_error, count(*) from repos where failed_attempts > 0 group by last_error;`
Restart errors
`update repos set failed_attempts=0, last_error='' where failed_attempts >0;`
Take a look at slow queries
```
SELECT pid, age(clock_timestamp(), query_start), state, query
FROM pg_stat_activity