Cursors

From: Natalie Wenz <nataliewenz(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Cursors
Date: 2018-08-15 21:21:00
Message-ID: 0E01B4A9-D944-4300-8A56-FC14DFFAB999@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


I have a couple of general questions regarding cursors.

First, does something like this hold open one transaction, or is each fetch a separate transaction? As a dba I'm wondering if this would interfere with maintenance operations (xid rolling via autovacuum, attaching/detaching partitions, etc).

declare cursname no scroll cursor without hold for ...
fetch forward 50000 from cursname

Secondly, on this particular thing (it's a three-table join, with one of those tables being very "wide", so there's definitely a pg_toast table that's involved besides), it seems to perform pretty terribly. What are the advantages of gathering records this way compared to doing a series of queries with a range (record number >= x and record number < y)?

Thanks for your help!
Natalie

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message raf 2018-08-15 21:41:11 Re: How to revoke privileged from PostgreSQL's superuser
Previous Message Scott Ribe 2018-08-15 21:16:28 Re: How to revoke privileged from PostgreSQL's superuser