Thank you very much, got it.
BTW, i read whole block of text 3 times (.
I'd liked to see this line added to docs:
"itersize" only changes how records are fetched from the backend, not
how they are returned
2012/5/16 Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>:
> On Wed, May 16, 2012 at 1:45 PM, Kryklia Alex <kryklia(at)gmail(dot)com> wrote:
>> Thank you for fast response.
>> Sorry, Daniel, for accidentally sending you answer.
>> As i understood, to enable debug in psycopg2 i need to recompile it?
> Yes, adding PSYCOPG_DEBUG to the define in setup.cfg and then running
> python with the env variable PSYCOPG_DEBUG set to something.
>> Now without debug:
>> In : cur=conn.cursor('1234')
>> In : cur.itersize=3
>> In : cur.execute("select generate_series(1,20)")
>> In : for i in cur: print i,'end of iteration step'
>> (1,) end of iteration step
>> (2,) end of iteration step
>> (3,) end of iteration step
>> I assuming, that chunk of data on every iteration consists of 3 ints:
>> (1,2,3,) end of iteration step
> No, this is not the case.
>> As mentioned in docs:
>> The attribute itersize now controls how many records are fetched at
>> time during the iteration:
>> Or i misunderstood the docs?
> Yes, I think you got the docs wrong: itersize records are fetched from
> the backend, but iteration still yields one record at time. The entire
> paragraph reads:
> Named cursors are also iterable like regular cursors. Note however
> that before Psycopg 2.4 iteration was performed fetching one record at
> time from the backend, resulting in a large overhead. The attribute
> itersize now controls how many records are fetched at time during the
> iteration: the default value of 2000 allows to fetch about 100KB per
> roundtrip assuming records of 10-20 columns of mixed number and
> strings; you may decrease this value if you are dealing with huge
> "itersize" only changes how records are fetched from the backend, not
> how they are returned. I think the paragraph as a whole is clean
> enough. However, if you or anybody else can suggest a better wording,
> docs patches are welcome.
> -- Daniele
In response to
psycopg by date
|Next:||From: Daniele Varrazzo||Date: 2012-05-17 15:06:27|
|Subject: reset implementation|
|Previous:||From: Daniele Varrazzo||Date: 2012-05-16 12:59:46|
|Subject: Re: Question aboud #80 - itersize in cursor dic|