2

For testing purposes is has become necessary to insert data in Postgres as quickly as possible. We are talking

  1. Ruby on Rails app
  2. 8 gigs sized binary psql dump put on RAMdisk
  3. Running on Ubuntu 18 server based VM with 32 gigs RAM

The goal is to spawn a very short-lived app instance for testing, so data security and persistence is not a concern. #1 priority is to insert dump to postgres and run any data migrations as quick as possible.

The first idea I get is put Postgres data-folder to RAMdisk. In theory, this should make I/O way faster even than using SSD.

Please share if you have any experience with running postgres in-memory.

P.S. I have read this: Optimise PostgreSQL for fast testing ; and still trying to get an edge with this RAMdisk idea.

Stepan Salin
  • 179
  • 1
  • 1
  • 10

2 Answers2

2

You won't get as much benefit out of a RAMdisk as you might think. Though, depending on how much performance improvement you need, it might be good enough and it's certainly an easy solution.

This whitepaper should be informative: https://www.mcobject.com/december05-2001/ The paper is, of course, written by us (McObject) and uses eXtremeDB to illustrate it's points, but the points are vendor-neutral (i.e. why a RAMdisk is inferior to any true in-memory database system).

Steven Graves
  • 837
  • 6
  • 9
1

Yes, sure, that will work.

You can further speed up processing by using UNLOGGED tables throughout.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263