Posts: 79
Threads: 5
Joined: May 2006
Reputation:
0
I've just been playing around with the built in sql, and it's pretty slow. It takes about 100ms for an INSERT, so putting GeoLite into a database would take over 2.5 hours. Is this normal, a bug or am I doing something horribly wrong?
Posts: 1,896
Threads: 102
Joined: Oct 2008
are you sure its sql or your pc thats really slow?
you should have put this in Scripting Discussion.
Posts: 202
Threads: 0
Joined: May 2007
Reputation:
0
When performing queries and your only returning a set amount of data/rows, use LIMIT, for example if your logging someone in SELECT * FROM table WHERE(username = username, password = password) LIMIT 1;
Posts: 79
Threads: 5
Joined: May 2006
Reputation:
0
Thanks for the tips, using transactions helps lots. ~100k INSERTs in 7 seconds, 4 of them for processing the file, 3 for the INSERTs which isn't too bad.
SELECT statements don't seem to be that slow, using "LIMIT 1" doesn't seem to have any effect on the speed. Using SELECT to get a country from ~100k entries takes about 200 ms if nothing is found, which I'm guessing is the worst case since some only take 1ms.
No idea if these numbers are normal or samp being slow, it's almost usable but still not as good as using file operations (the worst case for getting a country is 170ms).
Posts: 377
Threads: 0
Joined: Jan 2008
Reputation:
0
SQLite is native to SA:MP and uses a single file for the database, MySQL is only provided via plugins and has to connect to a server thus is MUCH slower.