Why Is My pg_xlog Directory So Big? I am running a PostgreSQL 9.5 datbase. There is a master and a slave that is configured as hot_standby using streaming replication (I don't think this is related).  

On the master I have the following wal settings:

postgres=# select name, setting, unit from pg_settings where name like '%wal_%';
             name             |   setting   | unit
------------------------------+-------------+------
 max_wal_senders              | 5           |
 max_wal_size                 | 128         | 16MB
 min_wal_size                 | 64          | 16MB
 wal_block_size               | 8192        |
 wal_buffers                  | 983         | 8kB
 wal_compression              | off         |
 wal_keep_segments            | 10          |
 wal_level                    | hot_standby |
 wal_log_hints                | off         |
 wal_receiver_status_interval | 10          | s
 wal_receiver_timeout         | 60000       | ms
 wal_retrieve_retry_interval  | 5000        | ms
 wal_segment_size             | 2048        | 8kB
 wal_sender_timeout           | 60000       | ms
 wal_sync_method              | fdatasync   |
 wal_writer_delay             | 200         | ms
(16 rows)


I guess the pg_xlog directory should grow to be 2GB max (max_wal_size = 128 * 16MB = 2GB), but it is 5GB now. 

I don't understand why.
I had streaming replication set up using a replication slot, but the slave did not use the slot.
Writing

primary_slot_name = 'replication_slot_1'


in /var/lib/postgresql/9.5/main/recovery.conf on the slave solved the problem.