PostgreSQL In Memory Database

前端 未结 4 1917
小蘑菇
小蘑菇 2021-01-31 05:04

I want to run my PostgreSQL database server from memory. The reason is that on my new server, I have 24 GB of memory, and hardly any of it is used.

I know I can run thi

相关标签:
4条回答
  • 2021-01-31 05:32

    I'm now using streaming replication which is async. This means my MASTER could be running all in memory, with the separate SLAVE instance using traditional disk.

    A machine restart would involve stopping the SLAVE, copying the postgresql data back into ramdisk and then restarting the MASTER followed by the SLAVE. This would be an interesting possibility which compares well with something like REDIS, but with the advantage of redundancy / hotstandby / backup / sql / rich toolset etc.

    0 讨论(0)
  • 2021-01-31 05:42

    The answer is caching. Look into adding memory to the server, then tuning PostgreSQL to maximize memory usage. Also, the file system cache will help with this, doing some of it automatically. You will be able to speed up performance, almost as if it were in memory except for the first hit, while not having to manage it yourself, and being able to have a database larger than the physical memory.

    0 讨论(0)
  • 2021-01-31 05:44

    have you seen the Server Configuration manual chapter? check it out, then google postgresql memory tuning.

    0 讨论(0)
  • 2021-01-31 05:44

    I have to believe that Postgres is written in such a way as to take full advantage of available RAM in the server. As you may have guessed by now, there's no reliable way to do this outside of Postgres.

    Within Postgres, transactions assure that all operations are atomic, so if the power goes down while you are writing to a Postgres database, you will only lose that particular operation, and not the entire database.

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