Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite faster than MySQL?

I want to set up a teamspeak 3 server. I can choose between SQLite and MySQL as database. Well I usually tend to "do not use SQLite in production". But on the other hand, it's a teamspeak server. Well okay, just let me google this... I found this:

  1. Speed
    SQLite3 is much faster than MySQL database. It's because file database is always faster than unix socket. When I requested edit of channel it took about 0.5-1 sec on MySQL database (127.0.0.1) and almost instantly (0.1 sec) on SQLite 3. [...]

http://forum.teamspeak.com/showthread.php/77126-SQLite-vs-MySQL-Answer-is-here

I don't want to start a SQLite vs MySQL debate. I just want to ask: Is his argument even valid? I can't imagine it's true what he says. But unfortunately I'm not expert enough to answer this question myself.

Maybe TeamSpeak dev's have some major differences in their db architecture between SQLite and MySQL which explains a huge difference in speed (I can't imagine this).

like image 264
boop Avatar asked Apr 04 '15 22:04

boop


People also ask

Is SQLite or MySQL faster?

SQLite3 is much faster than MySQL database. It's because file database is always faster than unix socket.

Is MySQL or SQLite better?

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.

What is faster than SQLite?

With Actian Zen, developers and product managers get all the advantages of SQLite but in a powerful, secure, and scalable engine that can run serverless or as a client-server. Actian Zen is orders of magnitude faster than SQLite.

Is SQLite faster than SQL Server?

SQLite is generally a lot faster than SQL Server. However, SQLite only supports a single writer at a time (meaning the execution of an individual transaction). SQLite locks the entire database when it needs a lock (either read or write) and only one writer can hold a write lock at a time.


1 Answers

At First Access Time will Appear Faster in SQLite

The access time for SQLite will appear faster at first instance, but this is with a small number of users online. SQLite uses a very simplistic access algorithm, its fast but does not handle concurrency.

As the database starts to grow, and the amount of simultaneous access it will start to suffer. The way servers handle multiple requests is completely different and way more complex and optimized for high concurrency. For example, SQLite will lock the whole table if an update is going on, and queue the orders.

RDBMS's Makes a lot of extra work that make them more Scalable

MySQL for example, even with a single user will create an access QUEUE, lock tables partially instead of allowing only single user-per time executions, and other pretty complex tasks in order to make sure the database is still accessible for any other simultaneous access.

This will make a single user connection slower, but pays off in the future, when 100's of users are online, and in this case, the simple "LOCK THE WHOLE TABLE AND EXECUTE A SINGLE QUERY EACH TIME" procedure of SQLite will hog the server.

SQLite is made for simplicity and Self Contained Database Applications.

If you are expecting to have 10 simultaneous access writing at the database at a time SQLite may perform well, but you won't want an 100 user application that constant writes and reads data to the database using SQLite. It wasn't designed for such scenario, and it will trash resources.

Considering your TeamSpeak scenario you are likely to be ok with SQLite, even for some business it is OK, some websites need databases that will be read only unless when adding new content.

For this kind of uses SQLite is a cheap, easy to implement, self contained, perfect solution that will get the job done.

like image 83
José Algarra Avatar answered Sep 23 '22 02:09

José Algarra