Re: Iterating through cur and cur.fetchone()

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: Iterating through cur and cur.fetchone()
Дата
Msg-id CA+mi_8ZA3b3+NbcW6uonovkJuCPn-4Kn1TNLJYEXCZ56yX6U2A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Iterating through cur and cur.fetchone()  (Håvard Wahl Kongsgård <haavard.kongsgaard@gmail.com>)
Список psycopg
2011/10/10 Håvard Wahl Kongsgård <haavard.kongsgaard@gmail.com>:
> Sorry, I stupid mistake. But I have been using psycopg for a year and
> I have some issue with memory usage on large cursors.
> Any tips on how to reduce the memory usage.

You can use server-side cursors, aka named cursors
<http://initd.org/psycopg/docs/usage.html#server-side-cursors>. In the
latest psycopg versions, iteration on the cursor (i.e. the "for record
in cur: ..." syntax) is more efficient than iterating with fetchone.
Everything is explained in the docs.

-- Daniele

В списке psycopg по дате отправления:

Предыдущее
От: Håvard Wahl Kongsgård
Дата:
Сообщение: Re: Iterating through cur and cur.fetchone()
Следующее
От: thomas veymont
Дата:
Сообщение: using server side cursor