[英]simple fetch is really slow
I am fetching all the instances for a given linkname but I want to call all their values(rating2) to perform a calculation, I debugged and all my time is in the query and fetch lines, I only have a table with 100 items and it is taking 2 seconds!!!!! 我正在获取给定链接名的所有实例,但我想调用其所有值(rating2)进行计算,我进行了调试,所有时间都在查询和获取行中,我只有一个包含100个项目的表,并且需要2秒!!!!! How can it be this slow to fetch a few items out of a 100 item table and how can I speed this up?
从100个项目表中提取几个项目的速度如何这么慢?我该如何加快速度? I am running this in the command console and calling the appengine_console.py and running my script that way, is it possible that would cause any sort of delay?
我在命令控制台中运行此程序,并调用appengine_console.py并以这种方式运行我的脚本,是否有可能导致任何形式的延迟?
class LinkRating2(db.Model):
user = db.StringProperty()
link = db.StringProperty()
rating2 = db.FloatProperty()
def sim_distance(link1,link2,tabl):
# Get the list of shared_items
si={}
query = tabl.all()
query2 = tabl.all()
a = query.filter('link = ', link1)
b = query2.filter('link = ', link2)
adic ={}
bdic= {}
aa = a.fetch(10000)
bb = b.fetch(10000)
UPDATE/EDIT Hi guys, I put a call to the sim distance function on my main loading page, I am calling sim_distance thousands of times in another function and to my amazement it is taking only 15ms to execute! UPDATE / EDIT嗨,大家好,我在主加载页面上调用了sim distance函数,我在另一个函数中调用了sim_distance数千次,而令我惊讶的是,它只需15毫秒即可执行! Here is what I don't understand, why does it take 2 seconds per call when I am running it in the appengine_console.py in the command window?
这是我不明白的原因,为什么我在命令窗口的appengine_console.py中运行每次调用需要2秒? I took an hour to run in the cmd window but instantaneously about when running it from explorer window.
我花了一个小时在cmd窗口中运行,但瞬间从浏览器窗口中运行了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.