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
.
我有一个md5哈希列表,每个哈希对应一个文件名。如果放入PHP数组,我会获取像$ md5 ['filename']这样的数据,在SQL表中,我会使用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.
哪种方法更快?一个人用较少的数据执行速度比另一个人执行得快,但是更长的数据更长我正在看的md5哈希值约为1100哈希值。
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?
这是静态数据,尽管哈希量会随着时间的推移而增加。 SQL连接时间会有很大的不同吗?比另一个更实用吗?如果是这样,为什么?
1 个解决方案
#1
4
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.
从数组中获取数据的速度更快,因为必须连接到涉及的数据库。 PHP正在从内存中直接获得值,这是你能得到的最快速度。
#1
4
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.
从数组中获取数据的速度更快,因为必须连接到涉及的数据库。 PHP正在从内存中直接获得值,这是你能得到的最快速度。