Reputation: 91609
I have a list of md5 hashes, each corresponding to a file name. If put in a PHP array, I would fetch the data like such $md5['filename']
and in a SQL table, I would use SELECT filename FROM hashes WHERE md5 = $md5
.
Which method is faster? Does one perform faster than the other with less data, but longer with more? The amount of md5 hashes I'm looking at is about 1100 hashes.
This is static data, although the amount of hashes will increase over time. Does SQL connect time make a big difference? Is one more practical than the other? If so, why?
Upvotes: 1
Views: 553
Reputation: 219794
Getting data from an array is faster as there is o overhead of having to connect to a database involved. PHP is getting the value straight from memory which is as fast as you can get.
Upvotes: 4