# PostgreSQL plugin v 6.0

**URL:** https://discourse.orthanc-server.org/t/postgresql-plugin-v-6-0/4326
**Category:** Releases
**Created:** [February 9, 2024, 9:36am UTC](https://discourse.orthanc-server.org/t/postgresql-plugin-v-6-0/4326 "2024-02-09T09:36:58Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![alainmazy](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/alainmazy/32/1576_2.png) [@alainmazy](https://discourse.orthanc-server.org/u/alainmazy)
#### Post date: [February 9, 2024, 9:36am UTC](https://discourse.orthanc-server.org/t/postgresql-plugin-v-6-0/4326/1 "2024-02-09T09:36:58Z")

</div>

Hi everyone,

The PostgreSQL plugin v 6.0 is now available. Together with Orthanc 1.12.3, it allows changing the transaction isolation level from `Serializable` to `ReadCommitted` which greatly improves Orthanc ingest performance. Note that this new mode, currently needs to be enabled in the plugin configuration - the `Serializable` mode remains the default.

Link to the [full release notes](https://orthanc.uclouvain.be/hg/orthanc-databases/file/OrthancPostgreSQL-6.0/PostgreSQL/NEWS)

As usual, these updates are available:

- as part of the [Windows Installers 24.2.1](https://www.orthanc-server.com/download-windows.php)
- as part of the [orthancteam/orthanc:24.2.1 Docker images](https://hub.docker.com/r/orthancteam/orthanc)

Enjoy !

Alain

---

<div class="post-metadata">

### Author: ![ranasrule](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/r/3e96dc/32.png) [@ranasrule](https://discourse.orthanc-server.org/u/ranasrule)
#### Post date: [February 9, 2024, 3:19pm UTC](https://discourse.orthanc-server.org/t/postgresql-plugin-v-6-0/4326/2 "2024-02-09T15:19:40Z")

</div>

The configuration of “TransactionMode” goes in the Orthanc Postgresql config file or the main Orthanc config file?

---

<div class="post-metadata">

### Author: ![alainmazy](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/alainmazy/32/1576_2.png) [@alainmazy](https://discourse.orthanc-server.org/u/alainmazy)
#### Post date: [February 12, 2024, 8:51am UTC](https://discourse.orthanc-server.org/t/postgresql-plugin-v-6-0/4326/3 "2024-02-12T08:51:21Z")

</div>

In the PostgreSQL section, as stated in the documentation:  
[https://orthanc.uclouvain.be/book/plugins/postgresql.html#usage](https://orthanc.uclouvain.be/book/plugins/postgresql.html#usage)

---

<div class="post-metadata">

### Author: ![James](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/j/bc8723/32.png) [@James](https://discourse.orthanc-server.org/u/James)
#### Post date: [February 13, 2024, 10:21pm UTC](https://discourse.orthanc-server.org/t/postgresql-plugin-v-6-0/4326/4 "2024-02-13T22:21:11Z")

</div>

Hi Alain,

This is fantastic! Thank you.

I have installed it on 2 systems using the latest `orthancteam/orthanc` image and have noticed 2 oddities.

We use `MaximumStorageSize` as well as the Postgres DB plugin.  
On 1 system, I updated to the latest image and then needed to change `MaximumStorageSize` from 100000 to 90000. On restart, Orthanc never finished starting up. When I reverted the change, Orthanc started fine. I repeated this several times always with the same result.

On a second system, we ran out of disk space because the number of scans exceeded the `MaximumStorageSize` limit. This same system was recycling correctly prior to the Postgres v6 update.

I wonder if there is an issue calculating file size with the new plugin?

Let me know if I can provide any further info to help troubleshoot.

James

---

<div class="post-metadata">

### Author: ![alainmazy](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/alainmazy/32/1576_2.png) [@alainmazy](https://discourse.orthanc-server.org/u/alainmazy)
#### Post date: [February 14, 2024, 7:52am UTC](https://discourse.orthanc-server.org/t/postgresql-plugin-v-6-0/4326/5 "2024-02-14T07:52:59Z")

</div>

Hi James,

Indeed, I have reworked the way sizes are computed. Seems we need new integration tests since we have not detected any issues …

I’ll look into it ASAP.

Thanks for the report !

Alain.

---

<div class="post-metadata">

### Author: ![alainmazy](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/alainmazy/32/1576_2.png) [@alainmazy](https://discourse.orthanc-server.org/u/alainmazy)
#### Post date: [February 14, 2024, 4:17pm UTC](https://discourse.orthanc-server.org/t/postgresql-plugin-v-6-0/4326/6 "2024-02-14T16:17:44Z")

</div>

This issue has [been fixed in v6.1](https://discourse.orthanc-server.org/t/postgresql-plugin-v6-1/4340).

---

<div class="post-metadata">

### Author: ![James](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/j/bc8723/32.png) [@James](https://discourse.orthanc-server.org/u/James)
#### Post date: [February 14, 2024, 7:31pm UTC](https://discourse.orthanc-server.org/t/postgresql-plugin-v-6-0/4326/7 "2024-02-14T19:31:35Z")

</div>

Thank you Alain!!!

---

<div class="post-metadata">

### Author: ![alainmazy](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/alainmazy/32/1576_2.png) [@alainmazy](https://discourse.orthanc-server.org/u/alainmazy)
#### Post date: [March 2, 2024, 4:01pm UTC](https://discourse.orthanc-server.org/t/postgresql-plugin-v-6-0/4326/8 "2024-03-02T16:01:35Z")

</div>

Hi everyone,

A bit more information about the PostgreSQL plugin 6.0 and 6.1 that includes an upgrade of the DB schema.

For simple systems with a single Orthanc and “small database”, the process is fully automatic and you should not worry.

However, after applying this upgrade on more complex systems, we are sharing these lessons learned (also [available in the book](https://orthanc.uclouvain.be/book/plugins/postgresql.html#note-for-large-databases-and-multiple-orthanc-instances)):

When upgrading from revision 1 to revision 2, the upgrade might take quite some time. E.g, we have observed the upgrade taking 17 minutes on a DB with 300.000 studies and 150 millions instances. Orthanc will not respond during the upgrade. Therefore, if you have enabled autohealing (automatic restart in case Orthanc is not responsive), you should likely disable it during the first start with the PostgreSQL plugin v6.0.

Also note that, if you have multiple containers connected to the same DB, all containers will try to acquire an exclusive lock to perform the upgrade of the DB. Only one of them will actually perform the upgrade. Also note that you should not perform a rolling updates of the Orthanc containers when performing a DB upgrade. All Orthanc containers should use the same version of the plugin, the one that is compatible with the current revision.

Therefore, in complex setups, it might be simpler/safer to simply shut-down the Orthanc containers, perform the upgrade manually and then, restart the Orthanc containers with the newest version of the plugin.

To upgrade manually from revision 1 to revision 2, one might run this procedure on the existing DB:

```bash
$ wget https://orthanc.uclouvain.be/hg/orthanc-databases/raw-file/default/PostgreSQL/Plugins/SQL/Upgrades/Rev1ToRev2.sql
$ wget https://orthanc.uclouvain.be/hg/orthanc-databases/raw-file/default/PostgreSQL/Plugins/SQL/PrepareIndex.sql
$ psql -U postgres -f Rev1ToRev2.sql
$ psql -U postgres -f PrepareIndex.sql

```

This procedure is identical to the one performed automatically by Orthanc when it detects that an upgraded is required.

HTH,

Alain.

---

<div class="post-metadata">

### Author: ![dnudelman](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/d/e5b9ba/32.png) [@dnudelman](https://discourse.orthanc-server.org/u/dnudelman)
#### Post date: [May 20, 2024, 6:31pm UTC](https://discourse.orthanc-server.org/t/postgresql-plugin-v-6-0/4326/9 "2024-05-20T18:31:01Z")

</div>

I believe I am still having this issue on that latest version.

---

<div class="post-metadata">

### Author: ![diegovictorbr](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/diegovictorbr/32/1586_2.png) [@diegovictorbr](https://discourse.orthanc-server.org/u/diegovictorbr)
#### Post date: [May 29, 2024, 1:39am UTC](https://discourse.orthanc-server.org/t/postgresql-plugin-v-6-0/4326/10 "2024-05-29T01:39:43Z")

</div>

Wow, I guess I’ll leave MySQL behind! Well done!
