Does creating a tablespace on an NVMe disk improve performance?

Viewed 1383

Does creating a tablespace on an NVMe disk improve performance?

I currently have PostgreSQL installed on an SSD disk and I bought an NVMe disk to improve query and process performance. I created a tablespace on the NVMe disk and then created a database using that tablespace.

My question is whether this will really help make queries faster. The SSD has a speed of 500M / s vs 3000M / s that the NVMe has. I made some queries with the database using the default tablespace on SSD vs database with tablespace on NVMe and there is not much difference.

Is it necessary to install the PostgreSQL on the NVMe disk or is it not necessary?

1 Answers

You don't have to install PostgreSQL on fast storage to speed it up, but placing the data directory on fast storage can only be good.

It is too late to tell you that, but investing in hardware is the last thing you do when tuning a database.

Fast disks will only help if your workload is I/O bound, and in your case it will at best improve speed by a factor of six. Creating the proper index can easily improve performance by a factor of 1000.

To make the best of your investment, set effective_io_concurrency and random_page_cost to reflect the physical properties of your storage, so that PostgreSQL can make the best of it.

The most cost effective kind of hardware tuning for databases is more RAM.

Related