0

Is it possible to configure PostgreSQL to run in-memory like H2 database?

I need this only in unit/integration tests.

7
  • You can create tablespace pointing to tmpfs or alternative RAM filesystem. Not sure if this is what you want. Only objects (tables, indexes, etc.) pointing to that tablespace will be stored in memory. Commented Aug 10, 2017 at 13:51
  • You can also set PGDATA to a ramfs then initdb the db there. It'll all disappear when you reboot etc. Commented Aug 10, 2017 at 16:30
  • 1
    @ŁukaszKamiński No, terrible advice, do not do that. Instead initdb a whole new DB in a tempfs. Never advise people to put tablespaces in temporary storage. Commented Aug 11, 2017 at 1:16
  • Downvoted due to obvious lack of effort with basic search before asking. stackoverflow.com/q/7872693/398670, stackoverflow.com/q/21288667/398670, stackoverflow.com/q/11764487/398670, ... Commented Aug 11, 2017 at 1:17
  • also stackoverflow.com/q/9407442/398670 Commented Aug 11, 2017 at 1:21

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.