count() question

Поиск
Список
Период
Сортировка
От Mitch Vincent
Тема count() question
Дата
Msg-id 021101bf490b$d43b7ec0$0300000a@doot.org
обсуждение исходный текст
Ответы Re: [SQL] count() question  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-sql
Hey guys, I'd like to thank Tom for his suggestion on the joins earlier. I
more/less knew that about the joins but had built everything up and sort of
stuck the sub-selects in there as a band-aid to fix a problem. I re-did all
the queries using nothing but joins and boy, it's a lot faster.

I have one problem though, this is a type of search engine so when I search
I can't display all the results on one screen, it has to be limited. I use
the LIMIT directive in the queries to do so. Before I had been going 2
queries, one to get the total number of results and one to just get 10 of
those results.

So my question is, is there anyway you can get the total number of results
(using count() or something) and still use the limit directive in the same
query? I tried looking at the number of result rows too but 10 (the limit)
is all I come up with.

I would really like to avoid doing 2 full queries here, if anyone has any
suggestions please let me know.

Thanks!!

-Mitch



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

Предыдущее
От: admin
Дата:
Сообщение: making 'like' queries quicker
Следующее
От: "Ranjan Polavarapu"
Дата:
Сообщение: Oracle Pro*c books