#1 2013-07-29 14:11:03

Roberto Schneiders
Member
From: Santa Catarina, Brazil
Registered: 2012-09-19
Posts: 127
Website

mORMot with SQLite3 - Internal vs. External

I am in doubt between using the internal database or external in mORMot.

From what I noticed, there are many different procedures that when you use an external database. Correct?

Say I choose to use the internal SQLite database. Can I switch to external later without changing the whole software?

Offline

#2 2013-07-29 16:21:45

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

Re: mORMot with SQLite3 - Internal vs. External

Yes, you can do things like that.
mORMot is pretty versatile: once you have defined your server model properties, and use only ORM methods, you can switch from internal to external just by registering (or not) the external DB properties before launching the server.

But if you want to continue using the same data, you will have to copy the data from the internal DB to the external.
There are some "pump" methods at SynDB classes level able to copy directly such content from any DB engine to another.

Or you can make all tables external.
Then re-use the same exact Sqlite3 file from internal to external - but I do not see the benefit of it.
For most queries, the ORM core is clever enough to directly call the external DB, and by-pass the "virtual" mode, so it will be almost as fast to use external DBs as internals.

Offline

#3 2013-07-29 16:44:36

Junior/RO
Member
Registered: 2011-05-13
Posts: 207

Re: mORMot with SQLite3 - Internal vs. External

What are the main advantages of using a Sqlite3 database as external database?

Offline

#4 2013-07-29 18:02:48

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

Re: mORMot with SQLite3 - Internal vs. External

Junior/RO wrote:

What are the main advantages of using a Sqlite3 database as external database?

Some points:
- It is faster than other databases (expect internal SQlite3 or in-memory TObjectList);
- You can split your tables between database files (e.g. for backup, safety or performance);
- If you want to change with another database engine (e.g. Oracle or FireBird), for one client or another, you can just change one code line and be sure that you are prepared for it;
- With the upcoming remote SynDB access unit, you can externalize the DB handling in another process.

Offline

Board footer

Powered by FluxBB