我正在使用Python2.7和sqlite3模块。你知道吗
以下是查询:
SELECT l.bggid, l.name FROM lastmonth l
INNER JOIN firstmonth f ON f.bggid = l.bggid
ORDER BY l.bggid DESC
LIMIT 20;
这个查询在独立的SQLite中工作得很好,但是Python会陷入困境,执行同一个查询需要将近10分钟的时间。你知道吗
但是如果我注释掉ORDER BY line或内部连接行,或者如果我连接到另一个able,它在Python中工作得很好。你知道吗
全文如下:
import sqlite3
# Connect to SQLite Database
db_loc = 'boardgamecollection_xml.sqlite' # name of database
conn = sqlite3.connect(db_loc)
c = conn.cursor()
query = '''SELECT l.bggid, l.name FROM lastmonth l
INNER JOIN firstmonth f ON f.bggid = l.bggid
ORDER BY l.bggid DESC
LIMIT 20;'''
c.execute(query)
print 'here'
print c.fetchall()
print "done"
conn.close()
编辑: 我从sqlite3模块切换到apsw,这似乎解决了问题。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐