PostgreSQL. Keep the table in random access memory (RAM)

Despite the fact that PostgreSQL is quite a powerful database, it does not include full support for storing tables in memory.
Below I will describe how to get PostgreSQL to store the selected table in RAM for fast operations with them.
Everything will happen in Debian.
Create an empty folder to mount

 

And smonriruem in the ramfs

 

Create a folder for PostgreSQL and assign it rights.
Next enter superuser postgres PostgreSQL database

 

And create a new TABLESPACE, accommodation which we ukažim in the folder with the installed ramfs

 

Will issue permissions for working with this TABLESPACE our user (for example, myuser)
Now we just have to create a new table and specify when creating a TABLESPACE ram.
For example:
Now PostgreSQL will work with this table as with the other without even knowing that she “liesin RAM.
That’s all.
Good luck.

 

Leave a Reply

Your email address will not be published. Required fields are marked *