如何在 Sql Compact 3.5 SP1 上重建/重新组织索引?
我有一个大型(40 Mo)SDF 数据库。
有些查询很长,但一段时间后会变得很快。
我想尝试整理我的索引,但我只找到 SQL Server 的信息,而不是 SQL CE 的信息。
I have a large (40 Mo) SDF database.
Some queries are very long, but can become quick after some time.
I would like to try to tidy up my indexes but I only find information for SQL Server and not for SQL CE.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不完全确定您认为需要完成哪种“整理” - 索引不会保存不必要的记录或其中的任何内容。如果您只是想恢复数据库中潜在的空白空间(索引和表),您可以使用 紧凑 或 Shrink SqlCeEngine 类中的方法。
Not exactly sure what sort of "tidying" you think needs to be done - the index won't be holding unnecessary records or anything in it. If you simply want to recover potentially empty space in the database (indexes and tables), you can use the either the Compact or Shrink methods in the SqlCeEngine class.
首次执行 SqlCeCommand 实例时,SQL CE 引擎需要为该查询生成查询计划。第一次执行总是比后续执行慢。您还可以重用命令实例并调用 SqlCeCommand 上的“Prepare”来标记用于生成查询计划的命令。
On the first execution of a SqlCeCommand instance the SQL CE engine needs to generate a query plan for that query. The first execution will always be slower then subsequent executions. You can also re-use command instances and call Prepare on the SqlCeCommand to mark the command for query plan generation.