Once I became interested in SQLite, I decided to check if it would be faster than MySQL, or at least equal in speed.
I assumed that SQLite would most likely be convenient for small tables, such as simple attendance counters.
Therefore, I
conducted the tests in the following way: I measured the time five times for 100 cycles of updating the record in the database and five times for 100 readings.
The code is
.
So, the
article urged: “
Recently, you may have heard of a new extension for PHP: SQLite. There are many reasons why SQLite may seem like a better accomplishment since you learned how to cut bread. SQLite offers a good SQL interface to non-relativistic database and creates an elegant alternative to unwieldy interfaces of other databases without loss of functionality or speed, as one would expect. "
See what happened on the tests ...
SQLite MySQL
Record
0.45911908149719 0.031841039657593
0.46412396430969 0.031555891036987
0.49027895927429 0.029323101043701
0.46884489059448 0.029382944107056
0.50253915786743 0.028644800186157
The average
0.47698121070862 0.030149555206299
Reading
0.026177883148193 0.060520172119141
0.026360988616943 0.059216022491455
0.026273012161255 0.062637090682983
0.026113986968994 0.062775135040283
0.026944160461426 0.062674045562744
The average
0.026374006271362 0.061564493179321
Amazing failure to write and reading advantage. However, thanks
ptalus , who shed light on this matter. The
manual says that for each entry the file opens and closes, which entails such inhibition, but it is worth adding
')
sqlite_query ($ dbhandle, 'BEGIN;');
sqlite_query ($ dbhandle, 'COMMIT;');
around the request and the recording time is just magically changing.
Record:
0.014724016189575
0.014418125152588
0.015676975250244
0.014610052108765
0.014219999313354
The average:
0.014729833602905
PS: for the time I spend the tests for the first time, tell me where I went.