相关疑难解决方法(0)

python postgres我可以fetchall()100万行吗?

我在python中使用psycopg2模块从postgres数据库中读取,我需要对列中的所有行进行一些操作,该行有超过100万行.

我想知道会cur.fetchall()失败或导致我的服务器出现故障?(因为我的RAM可能不会那么大,无法保存所有数据)

q="SELECT names from myTable;"
cur.execute(q)
rows=cur.fetchall()
for row in rows:
    doSomething(row)
Run Code Online (Sandbox Code Playgroud)

更聪明的方法是什么?

python postgresql fetchall

18
推荐指数
3
解决办法
2万
查看次数

标签 统计

fetchall ×1

postgresql ×1

python ×1