pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andreas Joseph Krogh <andreak@officenet.no>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: Returning the total number of rows as a separate column when using limit
Date: Mon, 05 Nov 2007 09:18:22 -0500
Message-ID: <18728.1194272302@sss.pgh.pa.us> (raw)
In-Reply-To: <200711050836.38130.andreak@officenet.no>
References: <200711050836.38130.andreak@officenet.no>

Andreas Joseph Krogh <andreak@officenet.no> writes:
> AFAICS the information about the *total* number of rows is in the "result" 
> somehow. When I execute a "limit 1" query with EXPLAIN ANALYZE, I se the 
> total number of columns in "rows=200819", so the information is there.

That's only an estimate.  Since the query doesn't get executed to
completion thanks to the LIMIT, Postgres really has no idea whether
the estimate is accurate.

			regards, tom lane



view thread (9+ messages)  latest in thread

Message-ID: <18728.1194272302@sss.pgh.pa.us>
Permalink:  ../18728.1194272302@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/18728.1194272302@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andreak@officenet.no
  Subject: Re: Returning the total number of rows as a separate column when using limit
  In-Reply-To: <18728.1194272302@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox