Any good rules of thumb on how to decide which of the two to use?
And, if you take over an Sqlite database, and the system is expected to "get much larger", how to decide whether to stick with it or move to MySql?
However, if you require scalability in terms of the number of database queries required, MySQL is the better choice. If you want any real degree of concurrency or require higher levels of security as well as user permissions management, MySQL wins over SQLite.
With SQLite being self-contained, other clients on a network would not have access to the database unlike with MySQL. This is also extended to multi-user capabilities. MySQL is able to handle many connections at the same time. However, SQLite is only able to handle one connection.
A good rule of thumb is to avoid using SQLite in situations where the same database will be accessed directly (without an intervening application server) and simultaneously from many computers over a network. SQLite will normally work fine as the database backend to a website.
In answer to the specific question of what happens if you do not close a SQLite database, the answer is quite simple and applies to using SQLite in any programming language. When the connection is closed explicitly by code or implicitly by program exit then any outstanding transaction is rolled back.
Their feature sets are not at all the same. Sqlite is an embedded database which has no network capabilities (unless you add them). So you can't use it on a network.
If you need
You need to use mysql or some other server-based RDBMS.
Note that MySQL is not the only choice and there are plenty of others which might be better for new applications (for example pgSQL).
Sqlite is a very, very nice piece of software, but it has never made claims to do any of these things that RDBMS servers do. It's a small library which runs SQL on local files (using locking to ensure that multiple processes don't screw the file up). It's really well tested and I like it a lot.
Also, if you aren't able to choose this correctly by yourself, you probably need to hire someone on your team who can.
The sqlite team published an article explaining when to use sqlite that is great read. Basically, you want to avoid using sqlite when you have a lot of write concurrency or need to scale to terabytes of data. In many other cases, sqlite is a surprisingly good alternative to a "traditional" database such as MySQL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With