comparison Sphinx/source/plugins/postgresql.rst @ 1036:b5f57cec7190

PG upgrades on large DB
author Alain Mazy <am@osimis.io>
date Sat, 02 Mar 2024 16:38:17 +0100
parents bbcec5f44c34
children edd8e2d0eb99
comparison
equal deleted inserted replaced
1035:9a7d252e1656 1036:b5f57cec7190
349 To downgrade from revision 2 to revision 1, one might run this procedure:: 349 To downgrade from revision 2 to revision 1, one might run this procedure::
350 350
351 $ wget https://orthanc.uclouvain.be/hg/orthanc-databases/raw-file/default/PostgreSQL/Plugins/SQL/Downgrades/Rev2ToRev1.sql 351 $ wget https://orthanc.uclouvain.be/hg/orthanc-databases/raw-file/default/PostgreSQL/Plugins/SQL/Downgrades/Rev2ToRev1.sql
352 $ psql -U postgres -f Rev2ToRev1.sql 352 $ psql -U postgres -f Rev2ToRev1.sql
353 353
354 Note for large databases and multiple Orthanc instances:
355 """"""""""""""""""""""""""""""""""""""""""""""""""""""""
356
357 When upgrading from revision 1 to revision 2, the upgrade might take quite some time. E.g, we have observed the upgrade
358 taking 17 minutes on a DB with 300.000 studies and 150 millions instances. Orthanc will not respond during the upgrade. Therefore,
359 if you have enabled autohealing (automatic restart in case Orthanc is not responsive), you should likely disable it
360 during the first start with the PostgreSQL plugin v6.0.
361
362 Also note that, if you have multiple containers connected to the same DB, all containers will try to acquire an exclusive lock
363 to perform the upgrade of the DB. Only one of them will actually perform the upgrade. Also note that you should not perform a
364 rolling updates of the Orthanc containers when performing a DB upgrade. All Orthanc containers should use the same version of the
365 plugin, the one that is compatible with the current revision.
366
367 Therefore, in complex setups, it might be simpler/safer to simply shut-down the Orthanc containers, perform the update
368 manually and then, restart the Orthanc containers with the newest version of the plugin.
369
370 To upgrade manually from revision 1 to revision 2, one might run this procedure::
371
372 $ wget https://orthanc.uclouvain.be/hg/orthanc-databases/raw-file/default/PostgreSQL/Plugins/SQL/Upgrades/Rev1ToRev2.sql
373 $ wget https://orthanc.uclouvain.be/hg/orthanc-databases/raw-file/default/PostgreSQL/Plugins/SQL/PrepareIndex.sql
374 $ psql -U postgres -f Rev1ToRev2.sql
375 $ psql -U postgres -f PrepareIndex.sql
376
354 377
355 Troubleshooting 378 Troubleshooting
356 --------------- 379 ---------------
357 380
358 SCRAM authentication 381 SCRAM authentication