Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can
Дата
Msg-id 26692.1165813038@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can  (Chris <dmagick@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Chris
Дата:
Сообщение: Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can
Следующее
От: Mark Kirkwood
Дата:
Сообщение: Re: SQL_CALC_FOUND_ROWS in POSTGRESQL / Some one can