21.12.2011, 14:05
Hey guys. So what's better to use, SQLite or MySQL? And by that I mean what to use when your server has UCP or some other things on web host which is somehow connected with the server.
Originally Posted by Justin
SQLite is great for testing and prototyping, or for embedding in applications. MySQL is worthy of (large scale) production environments.
Here is my personal summary: SQLite: easier to setup great for temporary (testing databases) great for rapid development great for embedding in an application not fit for production (in large scale) doesn't have user management doesn't have many performance features doesn't scale well. MySQL: far more difficult/complex to set up better options for performance tuning fit for a production database can scale well if tuned properly can manage users, permissions, etc. |
Thank you ****** so much. So if I want to connect to my database file remotley I just enter the IP address and the path to my DB file on that host? What I mean is: http://69.23.52.44/folder/file.db
|
I'd say SQLite for exactly the same reasons as those listed above! You are not running an enterprise server system distributed over hundreds of nodes with thousands of connections. You are running a SA:MP server, at that scale the features provided by SQLite are all you'll ever need...
|
I respectfully disagree, and would say MySQL is the better choice.
MySQL is faster, better with huge loads, the modern plugins support threading, and web integration is extremely simple with PHP. The only reason i can think of to use SQLite is because it requires no setup, and this may be easier for new scripters. Still though, most servers already have access to mysql servers from hosting companies/their websites... and if they for some reason dont, there are tons of tutorials and tools available to make this simple. The only thing that is left would be installing the plugin, which if they cant do, they have more important issues to worry about. Edit: It sort of becomes a battle of simplicity vs speed i guess. I'll always go with the method that is the fastest personally, even if that means taking a few more steps for setup (its a one time thing :P). I can understand you're a library writer though and want as little work as possible for the end users. |
Actually, I think SQLite is faster in SA-MP than the MySQL plugin is for executing queries.
|
Originally Posted by Kyosaur
Code:
[20:54:29] SQLite test starting... [20:54:42] SQLite Insert: 100 queries in 12684 ms [20:54:42] SQLite Select: 100 queries in 25 ms [20:54:42] >> SQLite Last select result: STRRRRRRRRRRRRIIIIIIIIIIIIIIIIIIING TEEEEEEEEEST [20:54:56] SQLite Update: 100 queries in 13692 ms [20:54:56] MySQL test starting.... [20:54:56] MySQL Insert: 100 queries in 35 ms [20:54:56] MySQL Select: 100 queries in 39 ms [20:54:56] >> MySQL Last select result: STRRRRRRRRRRRRIIIIIIIIIIIIIIIIIIING TEEEEEEEEEST [20:54:56] MySQL Update: 100 queries in 133 ms http://pastebin.com/BCn3KdSc Edit: By adding this line SQLite was speed up dramatically (Credits to cessil for the line): Code:
db_query(g_Sqlite, "PRAGMA synchronous = OFF" ); Code:
//test 1 [07:15:29] SQLite test starting... [07:15:30] SQLite Insert: 100 queries in 519 ms [07:15:30] SQLite Select: 100 queries in 12 ms [07:15:30] >> SQLite Last select result: STRRRRRRRRRRRRIIIIIIIIIIIIIIIIIIING TEEEEEEEEEST [07:15:30] SQLite Update: 100 queries in 342 ms [07:15:30] MySQL test starting.... [07:15:30] MySQL Insert: 100 queries in 23 ms [07:15:30] MySQL Select: 100 queries in 34 ms [07:15:30] >> MySQL Last select result: STRRRRRRRRRRRRIIIIIIIIIIIIIIIIIIING TEEEEEEEEEST [07:15:31] MySQL Insert: 100 queries in 120 ms //test 2 [07:15:50] SQLite test starting... [07:15:50] SQLite Insert: 100 queries in 439 ms [07:15:50] SQLite Select: 100 queries in 11 ms [07:15:50] >> SQLite Last select result: STRRRRRRRRRRRRIIIIIIIIIIIIIIIIIIING TEEEEEEEEEST [07:15:50] SQLite Update: 100 queries in 343 ms [07:15:50] MySQL test starting.... [07:15:50] MySQL Insert: 100 queries in 24 ms [07:15:51] MySQL Select: 100 queries in 34 ms [07:15:51] >> MySQL Last select result: STRRRRRRRRRRRRIIIIIIIIIIIIIIIIIIING TEEEEEEEEEST [07:15:51] MySQL Insert: 100 queries in 119 ms |
Code:
//test 1 [07:15:29] SQLite test starting... [07:15:30] SQLite Insert: 100 queries in 519 ms [07:15:30] SQLite Select: 100 queries in 12 ms [07:15:30] >> SQLite Last select result: STRRRRRRRRRRRRIIIIIIIIIIIIIIIIIIING TEEEEEEEEEST [07:15:30] SQLite Update: 100 queries in 342 ms [07:15:30] MySQL test starting.... [07:15:30] MySQL Insert: 100 queries in 23 ms [07:15:30] MySQL Select: 100 queries in 34 ms [07:15:30] >> MySQL Last select result: STRRRRRRRRRRRRIIIIIIIIIIIIIIIIIIING TEEEEEEEEEST [07:15:31] MySQL Insert: 100 queries in 120 ms //test 2 [07:15:50] SQLite test starting... [07:15:50] SQLite Insert: 100 queries in 439 ms [07:15:50] SQLite Select: 100 queries in 11 ms [07:15:50] >> SQLite Last select result: STRRRRRRRRRRRRIIIIIIIIIIIIIIIIIIING TEEEEEEEEEST [07:15:50] SQLite Update: 100 queries in 343 ms [07:15:50] MySQL test starting.... [07:15:50] MySQL Insert: 100 queries in 24 ms [07:15:51] MySQL Select: 100 queries in 34 ms [07:15:51] >> MySQL Last select result: STRRRRRRRRRRRRIIIIIIIIIIIIIIIIIIING TEEEEEEEEEST [07:15:51] MySQL Insert: 100 queries in 119 ms |
QUERIES | INSERT | UPDATE | SELECT |
100 | 6ms | 7ms | 4ms |
100000 | 5657ms | 4374ms | 3883ms |