title: PostgreSQL In Memory Database
body: <p>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. </p>
  
  <p>I know I can run this command to make a ramdisk:</p>
  
  <pre><code>mdmfs -s 1024m md2 /mnt
  </code></pre>
  
  <p>And I could theoretically have PostgreSQL store its data there. But the problem with this is that if the server crashes or reboots, the data will be gone. </p>
  
  <p>Basically, I want the database to be loaded in memory at all times so that it does not have to go to the hard disk drive to read every record, since I have TONS of memory and since memory is faster than hard disk drives. </p>
  
  <p>Is there a way to do this while also having PostgreSQL write to disk so I don't lose any data in case the server goes down? Or is there a way to cache all data in memory?</p>