title: Creating an in-memory table in PostgreSQL?
body: <p>My understanding of an in-memory table is a table that will be created in memory and would resort to disk as little as possible, if at all. I am assuming that I have enough RAM to fit the table there, or at least most of it. I do not want to use an explicit function to load tables (like pg_prewarm) in memory, I just want the table to be there by default as soon as I issue a <code>CREATE TABLE</code> or <code>CREATE TABLE AS select statement</code>, unless memory is full or unless I indicate otherwise. I do not particularly care about logging to disk.</p>
  
  <p>7 years ago, a similar question was asked here <a href="https://stackoverflow.com/questions/11729690/postgresql-equivalent-of-mysql-memory-tables">PostgreSQL equivalent of MySQL memory tables?</a>. It has received 2 answers and one of them was a bit late (4 years later).</p>
  
  <p>One answer says to create a RAM disk and to add a tablespace for it. Or to use an UNLOGGED table. Or to wait for global temporary tables. However, I do not have special hardware, I only have regular RAM - so I am not sure how to go about that. I can use UNLOGGED feature, but as I understand, there is still quite a bit of disk interaction involved (this is what I am trying to reduce) and I am not sure if tables will be loaded in memory by default. Furthermore, I do not see how global temporary spaces are related. My understanding of them is that they are just tables in spaces that can be shared.</p>
  
  <p>Another answer recommends an in-memory column store engine. And to then use a function to load everything in memory. The issue I have with this approach is that the engine being referred to looks old and unmaintained and I cannot find any other. Also, I was hoping I wouldn't have to explicitly resort to using a 'load into memory' function, but instead that everything will happen by default.</p>
  
  <p>I was just wondering how to get in-memory tables now in Postgres 12, 7 years later. </p>