BUG #12834: Avoiding Disk Control Writes for better Laptop / SSD compatibility. pgstats - Mailing list pgsql-bugs

From bryce2@obviously.com
Subject BUG #12834: Avoiding Disk Control Writes for better Laptop / SSD compatibility. pgstats
Date
Msg-id 20150305181432.2529.76377@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #12834: Avoiding Disk Control Writes for better Laptop / SSD compatibility. pgstats  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      12834
Logged by:          Bryce Nesbitt
Email address:      bryce2@obviously.com
PostgreSQL version: 9.4.1
Operating system:   Linux
Description:

This is an issue primarily for home computers and laptops which run
postgres, but not under heavy load.

Every minute postgresql runs the "stats" process which writes the following
files:

postgres(3814): CW /var/lib/postgresql/9.4/main/pg_stat_tmp/db_0.tmp
postgres(3814): CW /var/lib/postgresql/9.4/main/pg_stat_tmp/global.tmp
postgres(3814): CW /var/lib/postgresql/9.4/main/pg_stat_tmp/db_12066.tmp
postgres(3814): CW /var/lib/postgresql/9.4/main/pg_stat_tmp/global.stat
postgres(568): CW /var/lib/postgresql/9.4/main/base/12066/11868
unknown(568): CW /var/lib/postgresql/9.4/main/global/12062
unknown(568): CW /var/lib/postgresql/9.4/main/base/12066/11828
unknown(568): CW /var/lib/postgresql/8.4/main/base/12066/11833

This data was collected with "fatrace".  There's one set of writes per
installed version of postgres on the test system (8.1,9.1,9.3,9.4).

----

Would it be possible to have the stats process take no action and make no
writes to the disk, if there has been no database activity in the interval?

---
For laptops disk writes wake up the machine and/or harddrive.  For SSD's
it's a wear leveling issue.  With this write happening 24/7 on millions of
computers this is also an energy use optimization potential (reduce
electricity use from your keyboard!)

pgsql-bugs by date:

Previous
From: Andres Freund
Date:
Subject: Re: BUG #12833: Cannot cancel query or terminate backend if it client is SIGSTOPed
Next
From: Tom Lane
Date:
Subject: Re: BUG #12834: Avoiding Disk Control Writes for better Laptop / SSD compatibility. pgstats