Skip to content
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

创建备份数据库中的表时给opid_time列添加索引 #414

Closed
H2CO3Bearcard opened this issue Dec 23, 2021 · 3 comments
Closed

创建备份数据库中的表时给opid_time列添加索引 #414

H2CO3Bearcard opened this issue Dec 23, 2021 · 3 comments
Labels
wontfix This will not be worked on

Comments

@H2CO3Bearcard
Copy link

描述您想要的功能:
创建备份数据库中的表时给opid_time列添加索引,archery在生成回滚语句时会用此列查询,语句为:

select rollback_statement 
from xxxxxxxxxxxxxxxx_xxxx_xxxxx.xxxxx 
where opid_time='1639656399_408758713_00000568'

没有索引会造成全表扫描,回滚数据库压力增大
描述您考虑过的解决/替代方案:

func (s *session) mysqlCreateSqlFromTableInfo(dbname string, ti *TableInfo) string {

	buf := bytes.NewBufferString("CREATE TABLE if not exists ")
	buf.WriteString(fmt.Sprintf("`%s`.`%s`", dbname, ti.Name))
	buf.WriteString("(")

	buf.WriteString("id bigint auto_increment primary key, ")
	buf.WriteString("rollback_statement mediumtext, ")
	buf.WriteString("opid_time varchar(50),")
        buf.WriteString("KEY `idx_opid_time` (`opid_time`)")
	buf.WriteString(") ENGINE INNODB DEFAULT CHARSET UTF8MB4;")

	return buf.String()
}
@hanchuanchuan
Copy link
Owner

感谢建议,已优化,稍后发布新版本。

@hanchuanchuan
Copy link
Owner

请升级到v1.2.5-10版本。

@stale
Copy link

stale bot commented Apr 16, 2022

由于此问题没有最近的活动,因此已被自动标记为陈旧。如果没有进一步的活动,会作为不活跃issue关闭。感谢你对本项目的贡献。 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Apr 16, 2022
@stale stale bot closed this as completed Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants