简体   繁体   English

SQL Server Compact Edition 3.5性能

[英]SQL Server Compact Edition 3.5 performance

I am using SQL Server CE 3.5 SP1 in one of my client applications. 我在一个客户端应用程序中使用SQL Server CE 3.5 SP1。 When a user loads the program and starts using it, performance is fine. 当用户加载程序并开始使用它时,性能会很好。 If the user lets the program sit idle for a while, it takes a considerable amount of time (10 or more seconds) for the program to respond. 如果用户让程序闲置一会儿,则程序需要花费相当长的时间(10秒或更长时间)来响应。 Every time the user asks for a new screen, a call is made to the SQL CE database to get the data for that screen. 每次用户请求新屏幕时,都会调用SQL CE数据库来获取该屏幕的数据。 It seems like the hard drive may be going to sleep and then when the database is accessed, the hard drive has to wake back up. 似乎硬盘驱动器可能正在休眠,然后在访问数据库时,硬盘驱动器必须唤醒。 Is it possible to load the entire database into memory and work from that? 是否可以将整个数据库加载到内存中并从中工作? Are there any other suggestions on how to increase performance? 关于如何提高性能还有其他建议吗?

I doubt very much the problem is SqlCE. 我非常怀疑问题是SqlCE。 It is a very fast database. 这是一个非常快速的数据库。 In process. 进行中。 Moreover, I have loaded hundreds of thousands of records and I get the same performance if I was using SQL Express. 而且,我已经加载了数十万条记录,并且如果使用SQL Express,我将获得相同的性能。

Can you load the entire database? 您可以加载整个数据库吗? Sure, that is what ADO.NET is for. 当然,这就是ADO.NET的目的。 Don't do it. 不要这样

I suspect you have other issues. 我怀疑您还有其他问题。 For example, are you pre-processing the data before loading the form, such as setting data-set relations, added expression columns to data-tables, and so on. 例如,是否要在加载表单之前对数据进行预处理,例如设置数据集关系,将表达式列添加到数据表等? It is also possible that the user's computer does not have enough memory and what you are experiencing is Windows page faulting. 用户的计算机可能没有足够的内存,而您遇到的是Windows页面错误。 What you think is SqlCe accessing the databasse, is probably Windows swapping your application back into memory after being written to the paging file. 您认为SqlCe正在访问数据仓库,可能是Windows在将应用程序写入分页文件后将您的应用程序换回到内存中。

Make sure to keep a connection to the database open for the duration of your application. 确保在应用程序期间保持与数据库的连接处于打开状态。 Opening a SqlCeConnection is an expensive operation. 打开SqlCeConnection是一项昂贵的操作。

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

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