简体   繁体   English

Linq vs数据集。 全部存储在内存中还是分页查询?

[英]Linq vs Dataset. Store all in memory or paginiate query?

I am learning C# and trying to figure out more about collections. 我正在学习C#,并试图找出有关集合的更多信息。 I hired a tutor a few days ago and he was telling me the virtues of Linq for iterating through large data results, and so I was planning on using that, but now am wondering if I understood incorrectly. 几天前,我聘请了一位导师,他告诉我Linq遍历大数据结果的优点,因此我打算使用它,但现在想知道我是否理解不正确。

I am querying Mysql and will have up to 200,000 results which will need to be formatted and posted in groups of 500 to an HTTP server as JSON. 我正在查询Mysql,将有多达200,000个结果,这些结果需要格式化并以500组的形式作为JSON发布到HTTP服务器。 Should I be making a single query and then using Linq to paginate the results, or should I be breaking the SELECT up into groups of 500? 我应该先查询一个查询,然后使用Linq对结果进行分页,还是应该将SELECT分成500个一组?

My understanding is that the data flow is: 我的理解是数据流是:

Mysql
   => MysqlDataAdapter
      => Fill DataSet
         => Use Linq to paginate

Or 要么

Mysql
   => MysqlDataAdapter (Limit 500)
      => Fill DataSet

Just trying to figure out which way makes more sense from a performance perspective. 从性能的角度来看,只想弄清楚哪种方法更有意义。 It will be querying localhost. 它将查询本地主机。

在这里您可以找到一些比较方法,可以帮助您对datareader-vs-dataset-vs-linq进行比较

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM