Mike Zhao
Mike Zhao

Reputation: 480

what's the unit of max_wal_size in postgres view pg_setting

I tried to look into pg docs, but I can't find a clear statement mentioned what will be the unit value in pg_setting view for max_wal_size.

In pg 9.5, I have:

     name     | setting | unit |           category            |                  short_desc                   | extra_desc | context | vartype |       source
--------------+---------+------+-------------------------------+-----------------------------------------------+------------+---------+---------+-----------------
 max_wal_size | 64      | NULL | Write-Ahead Log / Checkpoints | Sets the WAL size that triggers a checkpoint. | NULL       | sighup  | integer | configuration fi
(1 row)
[public] # show max_wal_size ;
 max_wal_size
--------------
 1GB

in pg10.3, I have:

     name     | setting | unit |           category            |                  short_desc                   | extra_desc | context | vartype |       source
--------------+---------+------+-------------------------------+-----------------------------------------------+------------+---------+---------+-----------------
 max_wal_size | 1024    | MB   | Write-Ahead Log / Checkpoints | Sets the WAL size that triggers a checkpoint. | NULL       | sighup  | integer | configuration fi
(1 row)

[public] # show max_wal_size ;
 max_wal_size
--------------
 1GB
(1 row)

I think it's mentioned in this link: https://www.postgresql.org/message-id/11310.1475523980%40sss.pgh.pa.us, the reason why the unit value is 16MB in 9.5(a bug?), but it is going to be always MB going forward?

Thanks.

Upvotes: 1

Views: 775

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246083

The behavior changed in commit 9a3215026b and appears in PostgreSQL v10, but did not make it into the release notes. I would say that is no breaking change, but of course that is debatable.

Before the change, the unit was the size of a WAL segment, by default 16MB.

I don't see a reason why this should change again, but I don't know the future either.

Upvotes: 1

Related Questions