我想在数据集中显示大量数据,100,000 条记录大约 10 列,这会消耗大量 ram 700MB。我也尝试过使用分页,这可以减少大约 15-20%,但我不太喜欢使用分页时涉及的上一个/下一个按钮。我目前没有将数据写入磁盘,应该是吗?如果是这样,最常用的方法是什么?数据不会在查看时永久存储,然后可能会运行新查询并查看另外 70,000 条记录。最好的方法是什么?
感谢您的建议。
The reality is that the end-user rarely needs to see the totality of their dataset, so I would use which method you like for presenting the data (listview) and build a custom pager so that the dataset is only fed with the results of the number of records desired. Otherwise, each page load would result in re-calling the dataset.
The XML method to a temp file or utilizing a temp table created through a stored proc are alternatives but you still must sift and present the data.
An important question is where this data comes from. That will help determine what options are available to you. Writing to disk would work, but it probably isn't the best choice, for three reasons:
That is a lot of data to be working with and keeping aroudn in memory.
Is this a ASP.NET app? Or a Windows app?
I personally have found that going with a custom pager setup (to control, next previous links) and paging at the database level to be the only possible way to get the best performance, only get the data needed....
implement paging in SQL if you want to reduce the memory footprint
我建议使用内存映射文件...不确定 .NET 是否包含对它的支持。