pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chris <dmagick@gmail.com>
Cc: Joshua D. Drake <jd@commandprompt.com>
Cc: marcosborges@mbsi.com.br
Cc: pgsql-performance@postgresql.org
Subject: Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can
Date: Sun, 10 Dec 2006 23:57:18 -0500
Message-ID: <26692.1165813038@sss.pgh.pa.us> (raw)
In-Reply-To: <457CE03C.1060707@gmail.com>
References: <457814D3.1030001@mbsi.com.br>
	<457CD182.7020004@gmail.com>
	<1165809878.19970.2.camel@localhost.localdomain>
	<457CE03C.1060707@gmail.com>

Chris <dmagick@gmail.com> writes:
> Their docs explain it:
> http://dev.mysql.com/doc/refman/4.1/en/information-functions.html
> See "FOUND_ROWS()"

Sounds like a pretty ugly crock ...

The functionality as described is to let you fetch only the first N
rows, and then still find out the total number of rows that could have
been returned.  You can do that in Postgres with a cursor:

	DECLARE c CURSOR FOR SELECT ... (no LIMIT here);
	FETCH n FROM c;
	MOVE FORWARD ALL IN c;
	-- then figure the sum of the number of rows fetched and the
	-- rows-moved count reported by MOVE

			regards, tom lane



view thread (9+ messages)  latest in thread

Message-ID: <26692.1165813038@sss.pgh.pa.us>
Permalink:  ../26692.1165813038@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26692.1165813038@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-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dmagick@gmail.com, jd@commandprompt.com, marcosborges@mbsi.com.br
  Subject: Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can
  In-Reply-To: <26692.1165813038@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