#1 2018-04-04 08:01:09

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

The new sqlite3_serialize and sqlite3_deserialize functions

Hey!

If I understand it correctly, the new The new sqlite3_serialize and sqlite3_deserialize functions allows you to easily run the entire database in memory (deserialize) and when done, serialize it to a disk file!

For small-to-medium sized databases that can fit in the RAM properly, this approach can be a big performance improvement!

So @ab, I'm wondering how can achieve that with the mORMot framework smile


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#2 2018-04-04 08:33:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,670
Website

Re: The new sqlite3_serialize and sqlite3_deserialize functions

There are the raw API functions only available by now.
But we have enabled it for both the static .o/.obj and the external sqlite3-64.dll
It is a brand new feature, so we will perhaps wait a little before adding its support to TSQLDatabase.

Fell free to make experiments on it!
I just wonder how it performs in comparison to the backup feature, which could be used for what you propose.

Offline

#3 2018-04-04 16:47:22

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: The new sqlite3_serialize and sqlite3_deserialize functions

Good to hear that. I believe these two new API exist for a reason. At first glance, it achieve 'run in memory entirely' with just two calls, very easy and simple than the backup API.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#4 2018-04-04 20:17:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,670
Website

Re: The new sqlite3_serialize and sqlite3_deserialize functions

Interesting details from Richard Hipp directly at https://www.mail-archive.com/sqlite-use … 09120.html

Offline

#5 2018-04-05 04:40:49

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: The new sqlite3_serialize and sqlite3_deserialize functions

Another use case would be using the deserialized db as a data cache.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB