Methods to quickly spin up copies of an existing databases

Поиск
Список
Период
Сортировка
От Arjun Ranade
Тема Methods to quickly spin up copies of an existing databases
Дата
Msg-id CANrrCRxLYcoXw_VWD10jEYCAwYb-wX8AKSFxe8vaFDUHpnYS_Q@mail.gmail.com
обсуждение исходный текст
Ответы Re: Methods to quickly spin up copies of an existing databases
how best to specify table constraints with "create table as "
Список pgsql-general
I'm working on a project that requires on-demand creation of a fresh database as quick as possible (seconds).  Essentially, this is a build server that will require a cloned instance of Postgres to run unit tests on.  So the pattern of use would be:

  • Build is triggered
  • New postgres instance is created and connection details are provided to build server
  • Build runs unit tests that connect to the database
  • Build completes, database is no longer needed and can be thrown away
The "template" database will be approximately 50gb in size so my question is what is the fastest way to spin up new instances of this database?  I've thought of using "CREATE DATABASE WITH TEMPLATE..." but that takes too long.  I've also thought about cloning the $PGDATA directory, changing the port number in postgresql.conf, and starting a new instance of postgres pointing to the cloned data directory.

Both of these methods take longer than I'd like, so I'm wondering if anyone else has this use case and what methods they've used to solve this.

Thanks,
Arjun

В списке pgsql-general по дате отправления:

Предыдущее
От: Kenneth Marshall
Дата:
Сообщение: Re: Methods to quickly spin up copies of an existing databases
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Future Non-server Windows support???