JDP Science Tools

cancel
Showing results for 
Search instead for 
Did you mean: 

sqlite copy your database into RAM to speed it up

While running test I found out that having your sqlite database in RAM instead of on disk would speed up the query execution substantially.

And I found a rather simple way to "clone a database from file into memory", at first I tried with VACUUM but couldn't get it to work.
I thought I'd share my method, maybe someone has a better one.

 

Anyway, here's what I came up with

TiTou_0-1750853439146.png

 


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 1 of 3
(205 Views)

Note: that sqlite_master table also contains the exact SQL that the table was created with.  You can use that to create identical tables in your memory db (CREATE TABLE...AS... won't include things like primary or foreign key definitions and the like).

 

BTW, in Windows at least, the Windows File Cache generally makes things in memory without doing something like you're doing, but I think you are using Linux.

Message 2 of 3
(184 Views)

Indeed I am on Linux.

Thank you for the advice, I will look into this.


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 3 of 3
(173 Views)