Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can - Mailing list pgsql-performance

From Tom Lane
Subject Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can
Date
Msg-id 26692.1165813038@sss.pgh.pa.us
Whole thread Raw
In response to Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can  (Chris <dmagick@gmail.com>)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: Chris
Date:
Subject: Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can
Next
From: Mark Kirkwood
Date:
Subject: Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can