I created a a database table in MySQL called placenames -a simple list of 260K place names. The following code finds a name in the table super fast.
I created the same data in a SQLite 3 database with an index and it takes forever to read through the table and it hangs the server before it can finish executing this code:
Seems like there is no random access with the SQLite database even with the index. Why is MySQL so much faster?
Code:
$result = mysql_query("SELECT * FROM placenames");
while($row = mysql_fetch_array($result))
{ if ($place == $row['placename']) { do whatever etc ..
I created the same data in a SQLite 3 database with an index and it takes forever to read through the table and it hangs the server before it can finish executing this code:
Code:
foreach ($dbh->query('SELECT * FROM placenames') as $row)
{ if ($place == FoldDiacritics($row['placename']) ) { do whatever etc ..
Seems like there is no random access with the SQLite database even with the index. Why is MySQL so much faster?