-
Notifications
You must be signed in to change notification settings - Fork 845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
comfort格式做的有些粗糙了,可以改进和优化 #72
Comments
非常欣喜beifangxiuwhx对AliSQL的关注和宝贵意见。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
动态加字段的功能大概看了下代码和方案,基于compact格式做的改进,有两个明显的不足:
无法完美兼容compact格式,比如说一个compact的innodb表有100万的数据,使用alter table语句将其改为comfort,会发现alisql会将之前的100万数据全部刷一遍,将每行compact记录加一个字段(也就是n_fileds,表示该记录实际有多少个字段)。这就导致alter table的时间非常的长。
但是对于只改变格式,还没有增加字段的情况来说,n_fileds其实是没有作用的,还是有办法能够避免掉这部分时间的。
比较粗糙的是,如果在comfort格式下添加默认值为NULL的列,非常快,这是因为没必要将NULL值回写入compact row。但是如果默认值不为NULL,
例如alter table test add col1 varchar(100) default 'aaa',这个时候AliSQL会将原先的compact row也刷一遍,将默认值'aaa'写进去,测试时100万的情况下,时间也非常的久,这部分其实也可以优化掉。
要优化这两点,是有方案的,例如添加一张系统表统计默认值或者n_fileds信息,我觉得AliSQL团队也应该考虑过,不过没有这么做的原因是什么,性能问题?
The text was updated successfully, but these errors were encountered: