ALTER USER immichuser WITH ENCRYPTED PASSWORD 'pU2GU!!YE95bM&Gp'; #Postgress db password change

psql --dbname=immich --username=immichuser #log in to the postgress container

sudo docker exec -it Immich-DB psql --dbname=immich --username=immichuser Attach to container and directly login the psql

sudo docker exec -it Immich-DB psql --dbname=immich --username=immichuser --command="SELECT datname, checksum_failures, checksum_last_failure FROM pg_stat_database WHERE datname IS NOT NULL"

sudo docker exec -it Immich-DB pg_amcheck --username=immichuser --heapallindexed --parent-check --rootdescend --progress --all --install-missing

Check for database corruption

docker exec -it immich_postgres psql --dbname=postgres --username=<DB_USERNAME> --command="SELECT datname, checksum_failures, checksum_last_failure FROM pg_stat_database WHERE datname IS NOT NULL"  datname  | checksum_failures | checksum_last_failure-----------+-------------------+----------------------- postgres  |                 0 | immich    |                 0 | template1 |                 0 | template0 |                 0 |(4 rows)

Scan for file structure errors

docker exec -it immich_postgres pg_amcheck --username=<DB_USERNAME> --heapallindexed --parent-check --rootdescend --progress --all --install-missing

A normal result will end something like this and return with an exit code of 0:

7470/8832 relations (84%), 730829/734735 pages (99%)8425/8832 relations (95%), 734367/734735 pages (99%)8832/8832 relations (100%), 734735/734735 pages (100%)