Is it possible to get the number of items as well as the list of items without re-executing the query?
10 views
Skip to first unread message
Perry Smith
unread,
Aug 12, 2022, 4:39:24 PM8/12/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ruby-pg
I have a non-Rails, Ruby project using “pg” and Postgres 14.
I like what I call “baby sitting messages” which are print statements that say “22% complete”. To do that I need the number of elements that a result returns as well as the elements themselves. Is there a way to do this, assuming the results are too big to just cache up locally in the client, without executing the query twice? I’ve considered trying a weird join but that is going to get really messy. I thought perhaps the number of elements a query produces is already buried somewhere in what Postgres returns to the client and so I thought I would ask.