とりあえず
Pythonの辞書に110万件のデータを入れて、そこからランダムに1件取得する際に何十秒くらいかかるか調べてみた。
>>> from random import random >>> from time import clock >>> data = dict((str(i), random()) for i in range(1100000)) >>> t = clock(); print "select:", data[str(int(random()*1100000))]; print clock() - t, "sec" select: 0.692766546604 0.0483114474047 sec
0.05秒くらい。あとでオンメモリのSQLiteでどれくらいかかるのか調べる。
-
-
-
- -
-
-
追記
110万件のデータを全部なめて、ある特定カラムが条件に一致するような行の別のカラムの値を出力するコード。
>>> def foo(): t = clock() for k in data.keys(): if k == "110001": print "select where", data[k] print clock() - t, "sec" >>> foo() select where 0.895431963644 0.860433099738 sec
-
-
-
- -
-
-
実験に使ったデータがどの程度の量なのかがもうちょっとくわしく書かれていないと提案手法が早いのか遅いのか判断が付かないなぁ。