Skip site navigation (1) Skip section navigation (2)

large return resuls

From: maplabs(at)light42(dot)com
To: psycopg(at)postgresql(dot)org
Cc: nick(at)calthorpe(dot)com
Subject: large return resuls
Date: 2012-01-10 22:28:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: psycopg
Hi All-

  I am just returning to a psycopg2 project after a break.. 
We are using 2.4.2  on Linux, python 2.7, postgres 9.1

 If I make a query that returns truly large results
that is, both a lot of data per record, and a lot of records
What is the best way to handle that ?

Right now I just declare a cursor, execute() and then

for rec in cursor.fetchall():
  .... stuff .. 

on the hardware it is on, it is working fine apparently.. 
but it got me wondering.. 

fetchone()  fetchmany(..) and fetchall()
  will all basically pull the data at once, yes?

a server side cursor is the only way to bring data piece by piece, yes?



psycopg by date

Next:From: Daniele VarrazzoDate: 2012-01-11 00:27:06
Subject: Re: large return resuls
Previous:From: Daniele VarrazzoDate: 2012-01-10 21:57:44
Subject: Re: Use lo_creat() when possible instead of lo_create()

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group