首先创建一个包含易失性列的表以减少日志大小
我对此不太确定,但我想我之前读过它,我想知道这是对还是错:
创建表时,最好先放置易失性列,然后放置静态列。我的意思是,将可更新的列和不可更新的列放在最后。 这有利于减少事务日志的大小,因为每次修改一行时,日志都会写入旧行以及新行的列,直到最后一次更新。
Row
ID-PK, code, name , message
1 , 10 , "John Doe", "A funny message"
Update to
1 , 10 , "John Doe", "The message was changed."
在这种情况下,日志将完全写入新行。但是,如果我们更改列的顺序:
行
ID-PK, message , code, name<br/>
1 , "A funny message" , 10 , "John Doe"
更新为
1 , "The message was changed.", 10 , "John Doe"
事务日志将仅写入直到最后修改的列(1,“消息已更改。”),这可以提高将日志写入和传送到另一个列时的性能机器就像使用 HADR 时一样。
我想知道这是否属实,以及在哪里可以找到相关信息。
I am not sure about this, but I think I read it before, and I would like to know if that is true or false:
When creating tables, it is better to put volatile columns first and then the static columns. I mean, to put the columns that will be updatable, and the not updatable at the end.
This is good to reduce the size of the transaction log because each time a row is modified, the log will write the old row, and the columns of the new row till the last updated.
Row
ID-PK, code, name , message
1 , 10 , "John Doe", "A funny message"
Update to
1 , 10 , "John Doe", "The message was changed."
In this case, the log will write completely the new row. However, if we change the order of the columns:
Row
ID-PK, message , code, name<br/>
1 , "A funny message" , 10 , "John Doe"
Update to
1 , "The message was changed.", 10 , "John Doe"
The transaction log will only write the till the last modified column (1, "The message was changed.") and this could improve the performance while writting and shipping logs to another machine like when using HADR.
I would like to know if this is true, and where can I found information about this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当未启用完整数据更改捕获时,DB2 LUW 日志记录从数据更改的第一个字节开始,一直到数据更改的最后一个字节。 IBM 在其在线文档的标题为“对列进行排序以最大程度地减少更新日志记录"
When full data change capture is not enabled, DB2 LUW log records begin with the first byte where data changes and continue to the last byte where data changes. IBM offers the following recommendation in a section of their online documentation titled "Ordering columns to minimize update logging"