go-mssqldb icon indicating copy to clipboard operation
go-mssqldb copied to clipboard

Question - are result sets and rows streamed to the caller

Open mattharrigan opened this issue 2 years ago • 2 comments

Thank you for an excellent module. I have one fairly simple quetion. If a query is executed that returns a large amount of data, is the data collected in memory in its entirety before the query call returns? Alternatively, are rows and/or result sets made available to the caller as they are received? Essentially I would like to stream results, and am not sure if I should divide the large query into chunks, or just let the driver deal with it. For a little more clarity, suppose https://github.com/denisenkom/go-mssqldb#reading-output-parameters-from-a-stored-procedure-with-resultset returns 1 million rows. Would the first rows.Scan execute prior to all data being received? Thanks

mattharrigan avatar Jun 01 '22 13:06 mattharrigan

Also have this question

niger-prequel avatar Jan 13 '23 22:01 niger-prequel

TDS, the protocol, streams results back row by row, result set by result set.

The query itself may require finishing prior starting any return, such as a TOP 10 query or an ORDER BY query.

On Fri, Jan 13, 2023 at 4:53 PM niger-prequel @.***> wrote:

Also have this question

— Reply to this email directly, view it on GitHub https://github.com/denisenkom/go-mssqldb/issues/756#issuecomment-1382559026, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFYLMIVEMWCIMJ275ZRHA3WSHMGRANCNFSM5XRJTEGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

kardianos avatar Jan 14 '23 14:01 kardianos