Re: Number of rows in a cursor ?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Bo Lorentsen <bl(at)netgroup(dot)dk>
Cc: Russell Simpkins <russellsimpkins(at)hotmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Number of rows in a cursor ?
Date: 2005-08-24 17:46:12
Message-ID: 20050824174612.GB80642@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Aug 24, 2005 at 04:29:00PM +0200, Bo Lorentsen wrote:
> Michael Fuhr wrote:
> >...which is the same reason a cursor doesn't know how many rows it will
> >fetch until you fetch them all (or MOVE to the end of the cursor,
> >which fetches the rows internally).
>
> So, Postgresql is not hidding something for me, it just, like me, don't
> know ?

Right -- when you open a cursor PostgreSQL doesn't know how many
rows it will return. PostgreSQL selects a query plan based on an
*estimate* of how many rows the query will return, but until you
fetch all the rows you can't know for sure how many rows there will
be.

--
Michael Fuhr

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Scott Marlowe 2005-08-24 20:46:06 Re: how to do a select * and decrypt a column at the same
Previous Message Zac 2005-08-24 15:26:35 Re: How to join several selects