count and limit

Поиск
Список
Период
Сортировка
От Fabio Victora Hecht
Тема count and limit
Дата
Msg-id d2bb3d100608171412y7d498f5fu81639c3a6548783c@mail.gmail.com
обсуждение исходный текст
Ответы Re: count and limit
Список pgsql-general
Hi!

I've been using Postgresql for a while now and I'm very satisfied.

I was wondering if there's a way to count the results of a query and return part of the result set it in one query (LIMIT). Because I usually have to count the results using one query (to tell the user how many records match the criteria) and show the first 20 records.

It seems to me that could be optimized, because the database has to fetch the results to count, then again to return the page.

Hope I'm clear enough.

Thanks.

Fabio.


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

Предыдущее
От: "Alexander Farber"
Дата:
Сообщение: select * from users where user_id NOT in (select ban_userid from banlist)
Следующее
От: "Dawid Kuroczko"
Дата:
Сообщение: Re: Best approach for a "gap-less" sequence