denisenkom / go-mssqldb

Microsoft SQL server driver written in go language
BSD 3-Clause "New" or "Revised" License
1.81k stars 493 forks source link

Question - are result sets and rows streamed to the caller #756

Open mattharrigan opened 2 years ago

mattharrigan commented 2 years ago

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

niger-prequel commented 1 year ago

Also have this question

kardianos commented 1 year ago

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: @.***>