PostgreSQL – Using Two Tablespaces on SSD and SATA III HD

postgresqlpostgresql-9.3ssd

Continuing my previous question PostgreSQL maximize performance SSD the DBA SE community has given me efficient advice on optimal settings for PostgreSQL on SSD. The problem is that I will define two separate tablespaces, the first one is already on a SATA III Seagate Baracuda and one that I will set on the SSD (once the SSD arrives from the store). In that case, postgresql.conf should have two separate configurations (one for the SSD and one for the HDD). Is there any way to make settings separate per tablespace or per database, without having to restart the server and reload configurations? I am benchmarking for scientific research and basically I want to set two identical databases on the two tablespaces and compare query read performance between the SSD and HDD for my methods.

Best Answer

You can set seq_page_cost and random_page_cost per tablespace via ALTER TABLESPACE without restarting Postgres.