Re: Can I get the number of results plus the results with a single query?
От | Peter J. Holzer |
---|---|
Тема | Re: Can I get the number of results plus the results with a single query? |
Дата | |
Msg-id | 20220817092634.kp7atpc3zoqaovri@hjp.at обсуждение исходный текст |
Ответ на | Re: Can I get the number of results plus the results with a single query? (Bryn Llewellyn <bryn@yugabyte.com>) |
Список | pgsql-general |
On 2022-08-16 14:42:48 -0700, Bryn Llewellyn wrote: > hjp-pgsql@hjp.at wrote: > The OP wants some kind of progress indicator. To be useful, such > an indicator should be approximately linear in time. I.e. if your [...] > > > I see, Peter. You’d read the OP’s mind. Not much mind-reading involved, I hope. The first sentence in the message was: | I like to have what I call “baby sitting” messages such as “Completed 15 out of 1023”. That's what I would call a "progress indicator". Such things were already common when I first got involved with computers almost 40 years ago, so there isn't much to guess or to invent. > But I’d failed to. I saw the subject, you I assumed that the OP wanted > the entire result set together with the count of the results. (After > all, there’s no inflexions of “page” in the OP’s question.) I don't think his question was about paging. That's a different although related topic. > It sounds like the OP wants a fast approximate count for a query whose > restriction isn’t known until runtime. Maybe an approximate count would be enough, but he didn't say so. (He did later clarify that he's fetching a lot of data for each row, so «select count(*) ,,,» is indeed much faster than «select * ...» due to the sheer amount of data to be transferred. That wasn't obvious from his first message, but I hedged against the possibility in my answer.) hp -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"
Вложения
В списке pgsql-general по дате отправления: