Re: Way to use count() and LIMIT?
От | Mitch Vincent |
---|---|
Тема | Re: Way to use count() and LIMIT? |
Дата | |
Msg-id | 014b01c18844$64f75910$0200000a@Mitch обсуждение исходный текст |
Ответ на | Re: Way to use count() and LIMIT? ("SHELTON,MICHAEL (Non-HP-Boise,ex1)" <michael_shelton@non.hp.com>) |
Ответы |
Re: Way to use count() and LIMIT?
|
Список | pgsql-general |
> I gather the reason you don't actually run the whole query is because the > resultset would be too large? But you still want the database to work out > exactly how many there are. Not really because it's too large but because there isn't a need.. Imagine your favorite search engine, you search and the results are displayed "X Matches, displaying matches 1 to 10"... Same thing here -- at least that's what my need was... The query executed could get really stout (there were over 60 searchable fields across a variety of tables with hundreds of thousands of records in some) so executing the count() query, then the other certainly added the overhead... A cursor wasn't usable in this situation because the user could chose to search once, having only ten results displayed of 10,000 and leave the page (thus leaving me with an open cursor)..... But again, I see no solution to the above problem and understandably so, if you LIMIT a result set, you *limit* it -- asking it to contradict itself doesn't make any sense so I never complained that it wasn't possible :-) -Mitch
В списке pgsql-general по дате отправления: