解决方法
> What is the difference between Shrink and Compact in SQL Server CE?
来自SQL Server Compact Team Blog的报价:
SqlCeEngine/ISSCEEngine: Shrink Vs Compact The difference between
these two is much similar to Internal
and External Memory Fragmentation.From 07002:
Reclaims wasted space in the database
by moving empty and unallocated pages
to the end of the file,and then
truncating the file. You can
configure a database to automatically
shrink by setting the autoshrink
threshold option in connection string.
Shrink does not create a temporary
database file.From 07003:
Reclaims wasted space in the database
by creating a new database file from
the existing file. By creating a new
database means,it reclaims the free
space between rows.To be more clear,Shrink claims the
pages which are entirely free or
unallocated; where as,Compact claims
the wasted space with in the page too.
Hence Compact requires creating a new
database file.Empty space with in the page could be
as result of:1) If there were 5 rows in a page
and two of them are deleted2) If there was a row in the middle of the
page which on update required more
space,has moved out of the page (Ex:
nvarchar column update)Empty pages and unallocated pages
could remain in database as a result
of:1) All rows in a page are deleted
2) Whole table is dropped
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。