Re: Correct use of cursors for very large result sets in Postgres

From: Mike Beaton <mjsbeaton(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Correct use of cursors for very large result sets in Postgres
Date: 2017-02-21 12:36:36
Message-ID: CAHzAAWSRPmJLqoKwkCndBH-U=moULwV=o=NTd=pcoEkHvD9kyw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

The generated buffer is 140MB, not 14MB. At 14 bytes per row, that makes
sense.

I have done another test.

If I execute `FETCH ALL FROM cursor` I get a 140MB disk buffer file, on the
PostgreSQL server, reported in its log.

If I execute `FETCH 5000000 FROM cursor` (exactly half the rows), I see a
70MB disk buffer file.

This is regardless of how many rows I actually stream from thE connection
before closing the cursor.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2017-02-21 13:32:09 Re: Correct use of cursors for very large result sets in Postgres
Previous Message Diego Vargas 2017-02-20 21:39:52 Query Performance