-2
我有一個Django查詢,我需要遍歷的結果,但它是極其緩慢的結果......這裏是一些代碼遍歷Django的查詢
query = <Model>.objects.filter(<filter settings>
results = rollup(query) #This function isn't super important, it's basically just summing over
#specific fields that have specific properties, emptying the rest, and maintaing a few, the
#result is still a django query set
現在我要像做
for r in results:
#do stuff..
我嘗試過使用像prefetch_related
之類的東西,但我沒有看到非常明顯的結果。是否有其他改進我可以對此查詢執行
您是否已對其進行了配置? – shx2 2014-09-12 21:14:36
你嘗試過線程嗎? – ppalacios 2014-09-12 22:10:58
我們怎麼可能知道是否有任何事情要做?你已經提取出所有相關信息 – 2014-09-12 22:48:39