哪个是最快的数据收集?
在 Web 应用程序中,我必须从 SQL 视图中选择约 100 万行。 然后,这百万行用于显示具有向下钻取功能的条形图。
我一次性获取所有数据,并让用户深入了解内存中保存的数据集合。
我正在使用 ADO.Net (SqlCommand) 从数据库获取数据。
如何将数据存储在提供最快数据访问的数据集合中? DataTable 好还是 SqlReader 好还是数组好还是列表好?请建议
In a web application, I have to select ~1 million rows from a SQL view.
These million rows are then used to display a bar chart with drill down functionality.
I am bringing all of the data in one go and letting the user drill down on the data collection that is held in the memory.
I am using ADO.Net (SqlCommand) to get data from the database.
How do I store the data in the data collection that provides fastest data access? Is DataTable better or SqlReader or Arrays or List? Please suggest
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么需要让用户深入查看约 1M 条记录?
通常,如果用户需要立即查看所有数据集,并在 UI 中向下钻取,您将检索未过滤的数据集。然而,对于如此多的记录,它们不可能容纳整个集合,除非您以图形方式显示它们,例如 GIS 或其他图形数据点。
您最好问问自己是否可以首先向他们显示摘要/聚合视图(您可以通过存储过程获得),然后让他们通过使用他们选择的任何过滤器参数重新查询数据库来深入了解该视图。
SQL 服务器非常擅长处理此类操作。让您的投资为您服务。
Why do you need to let the user drill down through ~1M records?
Typically, you'd retrieve an unfiltered dataset if the user needs to see all of it at once, and drill down in the UI. However, with so many records, there's no way that they'd be able to take in the whole set unless, perhaps, you're displaying them graphically, like GIS or other graphical data points.
You may be better off asking yourself if you can initially show them a summary/aggregate view (which you could obtain through a stored procedure), and let them drill down through that by requerying the database with whatever filter parameters they select.
The SQL server is very good at handling this type of operation. Let your investment work for you.