我正在使用psycopg2(我升级到2.5版)在我的postgres数据库的python脚本中运行一个大型查询.查询完成后,我关闭光标和连接,甚至运行gc,但进程仍然消耗大量内存(确切地说是7.3gb).我错过了一个清理步骤吗?
import psycopg2
conn = psycopg2.connect("dbname='dbname' user='user' host='host'")
cursor = conn.cursor()
cursor.execute("""large query""")
rows = cursor.fetchall()
del rows
cursor.close()
conn.close()
import gc
gc.collect()
Run Code Online (Sandbox Code Playgroud) 我很高兴看到近期对地理空间指数的支持最近被添加到Meteor 0.6.6中的minimongo.但是,$ near(它应按距离排序)的排序行为似乎不具有反应性.也就是说,当文档被添加到集合中时,客户端会加载它,但始终在结果列表的末尾,即使它比其他文档更接近$ near坐标.刷新页面时,订单已更正.
例如:
服务器:
Meteor.publish('events', function(currentLocation) {
return Events.find({loc: {$near:{$geometry:{ type:"Point", coordinates:currentLocation}}, $maxDistance: 2000}});
});
Run Code Online (Sandbox Code Playgroud)
客户:
Template.eventsList.helpers({
events: function() {
return Events.find({loc: {$near:{$geometry:{ type:"Point", coordinates:[-122.3943391, 37.7935434]}},
$maxDistance: 2000}});
}
});
Run Code Online (Sandbox Code Playgroud)
有没有办法让它被反应排序?