开发者

SQL Server: mutliple tables returned vs multiple database calls

Is there any benefit in having my stored procedure return 4 separate tables as its result set rather than making 4 cal开发者_开发知识库ls to get these tables separately?


If you make 4 calls in your app, then you will need to either have 4 recordsets (or their asp.net equivilant) to store the data, or process the data between each call and re-use whatever you are using to store the data in the application prior to processing it. Plus there is a small amount of network overhead in making many calls to the database.

Getting them all at once will allow you to use one object to hold the data, you can make one connection to the db and probably close that connection early, prior to processing the data, and there is also potential for the database to optimize your query for grabbing all that data (depends on the query obviously)

Not so much an answer as a short list of pro's and con's, but hopefully helpful nonetheless.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜