简体   繁体   English

为什么.NET Sql Server的访问速度比Excel Interop快?

[英]Why is .NET Sql Server access faster than Excel Interop?

This might be a loaded question, and it might get voted down, but it completely frustrates me. 这可能是一个加载的问题,它可能会被拒绝,但它完全让我感到沮丧。

When you use SQL Server in your development the data access is fast and efficient, but when you use COM to talk to Excel it is piggy slow. 在开发中使用SQL Server时,数据访问速度快,效率高,但是当您使用COM与Excel通信时,速度很慢。

It doesn't matter what data access technology you use, ADO, ADO.NET, LINQ, Entity Framework, Astoria (ADO.NET Data Services), they are all quicker than automating Excel. 无论您使用何种数据访问技术,ADO,ADO.NET,LINQ,实体框架,Astoria(ADO.NET数据服务),它们都比自动化Excel更快。

If all you want is the data in cell "A1" from a Workbook, you need an Excel.Application, Excel.Workbook, Excel.Worksheet, and Excel.Range objects, just to get one data point. 如果您只需要工作簿中单元格“A1”中的数据,则需要Excel.Application,Excel.Workbook,Excel.Worksheet和Excel.Range对象,以获取一个数据点。

WTF, Why is talking to SQL Server more efficient than talking to Excel? WTF,为什么与SQ​​L Server交谈比与Excel交谈更有效? Excel is local and Sql Server may not be. Excel是本地的,Sql Server可能不是。

TIA Chris TIA克里斯

因为设计为交互式应用程序的大型单片可执行文件比通过快速网络与专为此目的而设计的应用程序交谈要慢。

Every time you need to talk to excel, the server has to actually start up the excel program. 每次你需要与excel交谈时,服务器必须实际启动excel程序。 It's in a hidden desktop, but it's still starting up the entire program. 它位于一个隐藏的桌面上,但它仍在启动整个程序。 If you have several people using the site, that's also several instances of Excel. 如果您有几个人使用该网站,那也是几个Excel实例。 And if they're sharing the same workbook it's even worse. 如果他们共享相同的工作簿,那就更糟了。

Sql Server, on the hand, is already running . 一方面,Sql Server 已经在运行 Just connect and go. 只需连接即可。 It was built for this kind of thing. 它是为这种东西而建的。 Excel wasn't. Excel不是。

Excel is still a com interop, even in 2007. but there is many helpers 即使在2007年,Excel仍然是一个com互操作。但是有很多帮助者

excel-performance-new-whitepaper-available Excel的性能新白皮书可用

spreadsheetgear 的SpreadsheetGear

excelpackage.codeplex excelpackage.codeplex

This is becuase SQL server is designed to server data, Excel is not. 这是因为SQL服务器是为服务器数据而设计的,而Excel则不是。 Network latency won't even come into play here until you are retreiving 1000's maybe even millions of rows from SQL server 在您从SQL服务器中检索1000甚至数百万行之前,网络延迟甚至不会发挥作用

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

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