Re: SQL_CALC_FOUND_ROWS equivalent in PostgreSQL

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: SQL_CALC_FOUND_ROWS equivalent in PostgreSQL
Дата
Msg-id 20070731143216.GA28226@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: SQL_CALC_FOUND_ROWS equivalent in PostgreSQL  (Oliver Elphick <olly@lfix.co.uk>)
Список pgsql-novice
On Tue, Jul 31, 2007 at 07:24:34AM +0100, Oliver Elphick wrote:
>    BEGIN;
>    SELECT * FROM mytable OFFSET X LIMIT Y;
>    SELECT COUNT(*) AS total FROM mytable;
>    END;
>
> (To ensure consistent results, both queries should be done in a single
> transaction.)

To ensure consistent results the transaction should be SERIALIZABLE.
With the default of READ COMMITTED changes between the two selects
would be visible to the second select.

--
Michael Fuhr

В списке pgsql-novice по дате отправления:

Предыдущее
От: Oliver Elphick
Дата:
Сообщение: Re: tsearch2.sql and different versions of PostgreSQL
Следующее
От: Paul Malherbe
Дата:
Сообщение: Querying multiple tables