温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Mysql相关技术举例分析

发布时间:2021-11-18 16:36:41 来源:亿速云 阅读:104 作者:iii 栏目:MySQL数据库

本篇内容介绍了“Mysql相关技术举例分析”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

1.复制过滤问题:
 --replicate-do-db=db_name:
USE prices;
UPDATE sales.january SET amount=amount+1000;
Statement-based replication:对于基于语句级的复制(或mixed级别),replicate_do_db这个参数指的是默认的数据库,即当前使用的数据库(use database),在默认数据库下更新replicate_do_db指定的数据库,从库不会随之更新,会有问题
解决:对于binlog_format=statement或mixed,只在从库设置replicate_wild_do_table= sales.%或replicate_wild_ignore_table即可。此时可以避免跨库更新问题。
对于binlog_format=statement或mixed,只在从库设置replicate_wild_do_table= quyou.%或replicate_wild_ignore_table即可。此时可以避免跨库更新问题。
对于binlog_format=statement或mixed,只在从库设置replicate_wild_do_table= quyou.%或replicate_wild_ignore_table即可。此时可以避免跨库更新问题。
Row-based replication:不存在问题


2.InnoDB单列索引长度不能超过767bytes限制问题
实际上联合索引还有一个限制是3072:
By default, the index key prefix length limit is 767 byte
When the innodb_large_prefix configuration option is enabled, the index key prefix length limit is raised to 3072 bytes for InnoDB tables that use DYNAMIC or COMPRESSED row format.
The limits that apply to index key prefixes also apply to full-column index keys.
If you reduce the InnoDB page size to 8KB or 4KB by specifying the innodb_page_size option when creating the MySQL instance, the maximum length of the index key is lowered proportionally, based on the limit of 3072 bytes for a 16KB page size. That is, the maximum index key length is 1536 bytes when the page size is 8KB, and 768 bytes when the page size is 4KB.

解决:
MySQL 5.5.14及其后版本解决了最大767字节索引长度的问题,引入了innodb_large_prefix配置关键字。这项关键字必须配合innodb_file_format和innodb_file_per_table
innodb_large_prefix = True
innodb_file_format = Barracuda
innodb_file_per_table = True

Barracuda 在原来的基础上(Antelope)新增了Dynamic和Compressed两种行格式。

“Mysql相关技术举例分析”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI