SQL Server Compact Edition 3.5 性能
我在我的一个客户端应用程序中使用 SQL Server CE 3.5 SP1。当用户加载该程序并开始使用它时,性能良好。如果用户让程序闲置一段时间,则程序需要相当长的时间(10 秒或更多秒)才能响应。每次用户请求新屏幕时,都会调用 SQL CE 数据库以获取该屏幕的数据。看起来硬盘驱动器可能会进入睡眠状态,然后当访问数据库时,硬盘驱动器必须重新唤醒。是否可以将整个数据库加载到内存中并从中进行工作?关于如何提高性能还有其他建议吗?
I am using SQL Server CE 3.5 SP1 in one of my client applications. 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. 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. 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我非常怀疑问题出在SqlCE上。这是一个非常快的数据库。处理中。此外,我已经加载了数十万条记录,并且使用 SQL Express 可以获得相同的性能。
你能加载整个数据库吗?当然,这就是 ADO.NET 的用途。不要这样做。
我怀疑你还有其他问题。例如,您在加载表单之前是否对数据进行了预处理,例如设置数据集关系、向数据表添加表达式列等。也有可能用户的计算机没有足够的内存,并且您遇到的是 Windows 页面错误。您认为 SqlCe 访问数据库可能是 Windows 在写入分页文件后将您的应用程序交换回内存。
I doubt very much the problem is 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.
Can you load the entire database? Sure, that is what ADO.NET is for. 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. What you think is SqlCe accessing the databasse, is probably Windows swapping your application back into memory after being written to the paging file.
确保在应用程序运行期间保持与数据库的连接打开。打开 SqlCeConnection 是一项昂贵的操作。
Make sure to keep a connection to the database open for the duration of your application. Opening a SqlCeConnection is an expensive operation.