Keeping postgres entirely in memory

后端 未结 1 1215
伪装坚强ぢ
伪装坚强ぢ 2021-02-09 06:53

I am running various tests that spend a lot of time in the database.

I\'d like to keep it all in memory and have it not touch the db, hopefully that would speed things u

相关标签:
1条回答
  • 2021-02-09 07:45

    I wrote a detailed post on this some time ago:

    Optimise PostgreSQL for fast testing

    You may find it informative; it covers options for making PostgreSQL run without durability and other tweaks that're useful for running tests.

    You do not actually need in-memory operation. If PostgreSQL is set not to flush changes to disk then in practice there'll be little difference for DBs that fit in RAM, and for DBs that don't fit in RAM it won't crash.

    You should test with the same database engine you're using in production. Testing with SQLite, Derby, H2, etc then deploying live on PostgreSQL doesn't make tons of sense... as any Heroku/Rails user can tell you from experience.

    0 讨论(0)
提交回复
热议问题