当前位置: 首页 > news >正文

做兼职网站设计雅思培训班价格一览表

做兼职网站设计,雅思培训班价格一览表,商业空间设计网站大全,商丘软文推广在实际的开发中,一般都会将数据存储到数据库中,在设计表的时候,其实id如果达到最大值的话,会出现什么问题。其实主要分两种情况,一种是设置了主键id,另一种没有设置主键id。 表定义自增值id create table…

在实际的开发中,一般都会将数据存储到数据库中,在设计表的时候,其实id如果达到最大值的话,会出现什么问题。其实主要分两种情况,一种是设置了主键id,另一种没有设置主键id。

表定义自增值id

create table test(id int unsigned auto_increment primary key) auto_increment=4294967295;
insert into test values(null);

我们创建了一个临时表,id 为 int 无符号 。范围在 0 到4,294,967,295。当时当我们在次插入一条记录的时候,1062 - Duplicate entry '4294967295' for key 'test.PRIMARY', Time: 0.000000s
直接返回了异常,抛出的是 4294967295 重复,可以得处的结论是 在申请下一个id时,得到的值保持不变,但是会主键冲突。

从业务层面考虑,其实单表撑到千万级别 性能就开始下降,所以很难达到十亿级别。

InnoDB系统自增 row_id

另一种情况就是没有指定主键,innoDB会创建一个不可见的,长度为6个字节的row_id , 维护一个全局的dict_sys.row_id值,所有无主键的表,每插入一行数据,将dict_sys.row_id 作为要插入的row_id,然后将row_id 值加1。

在这里插入图片描述
当时如果出现row_id = N的行,那么就会出现数据覆盖。

面试官:数据库自增 ID 用完了会咋样?

row_id 达到最大值后会从 0 重新开始算;前面插入的数据就会被后插入的数据覆盖,且不会报错。

所以,结合两种方式来看的话,其实更推荐设置一个逐渐id,因为相比数据丢失 可用性和可靠性,大多数应用,还是优先可靠性。

Xid

redo log和 bin log 配合的时候,会使用xid,用来对应事务。
MySQL 内部维护一个全局变量 global_query_id , 每次执行语句的时候将它赋值给 query_id ,将这个变量+1,如果这个语句是当前事务的第一条语句,就将这个事务 query_id 赋值给这个事务id。

global_query_id 是一个存内存的变量,每次重启就会清零,所以多个mysql实例可能存在相同的Xid, 但是bin log 文件也会重新生成,所以基本上不会出现同一个bin log出现两个相同的Xid

Innodb trx_id

Xid是server层维护的,InnoDB内部使用xid 是为了在Innodb事务和Server之间做关联,innodb自己的trx_id 另外维护。

innoDB内部维护一个max_trx_id 全局变量,每次申请一个trx_id 获取当前值使用,并且+1操作。

InnoDB 数据可见性的核心思想是:每一行数据都记录了更新它的 trx_id,当一个事务读到一行数据的时候,判断这个数据是否可见的方法,就是通过事务的一致性视图与这行数据的 trx_id 做对比

thread_id

thread_id 就是线程id, show processlist第一列就是。
在这里插入图片描述
系统保持了一个全局变量 thread_id_counter,每新建一个链接,就将thread_id_counter 赋值给这个新连接的线程变量。达到上限后会重置为0.

总结

所以对于主键id达到上限,就会出现主键冲突异常,但是对于无主键的就会重新设置为0,会覆盖原来的数据。


文章转载自:
http://dinncotito.ssfq.cn
http://dinncopentecostal.ssfq.cn
http://dinncosoberly.ssfq.cn
http://dinncocapricornus.ssfq.cn
http://dinncohobble.ssfq.cn
http://dinncofreight.ssfq.cn
http://dinncomitigatory.ssfq.cn
http://dinncofinlander.ssfq.cn
http://dinncoalopecia.ssfq.cn
http://dinncohalitosis.ssfq.cn
http://dinncosickle.ssfq.cn
http://dinncodelineate.ssfq.cn
http://dinncoanticipant.ssfq.cn
http://dinncoelectrocoagulation.ssfq.cn
http://dinncoworkday.ssfq.cn
http://dinncodolorimetry.ssfq.cn
http://dinncoagued.ssfq.cn
http://dinncosomatosensory.ssfq.cn
http://dinncopeptogen.ssfq.cn
http://dinncosubordinate.ssfq.cn
http://dinncowri.ssfq.cn
http://dinncoinfantility.ssfq.cn
http://dinncophilhellenist.ssfq.cn
http://dinnconicknack.ssfq.cn
http://dinnconeighboring.ssfq.cn
http://dinncounscrupulousness.ssfq.cn
http://dinncostiletto.ssfq.cn
http://dinncohoosh.ssfq.cn
http://dinncodialogically.ssfq.cn
http://dinncophosphoroscope.ssfq.cn
http://dinncomisdirect.ssfq.cn
http://dinncodoctoral.ssfq.cn
http://dinncomolto.ssfq.cn
http://dinncoparmigiana.ssfq.cn
http://dinncogruesome.ssfq.cn
http://dinncobrunch.ssfq.cn
http://dinncobivalent.ssfq.cn
http://dinncooffscreen.ssfq.cn
http://dinncounawares.ssfq.cn
http://dinncofiloplume.ssfq.cn
http://dinncogranodiorite.ssfq.cn
http://dinncozombi.ssfq.cn
http://dinncosabbatarianism.ssfq.cn
http://dinncolope.ssfq.cn
http://dinncodragging.ssfq.cn
http://dinncodigressive.ssfq.cn
http://dinncobrimstone.ssfq.cn
http://dinncotraitoress.ssfq.cn
http://dinncobirth.ssfq.cn
http://dinncomosstrooper.ssfq.cn
http://dinncojaponica.ssfq.cn
http://dinncoinvincible.ssfq.cn
http://dinncodownsman.ssfq.cn
http://dinncoinopportune.ssfq.cn
http://dinncohydromechanical.ssfq.cn
http://dinnconidify.ssfq.cn
http://dinncofluoridationist.ssfq.cn
http://dinncojellify.ssfq.cn
http://dinncomeet.ssfq.cn
http://dinncoundependable.ssfq.cn
http://dinncointerterm.ssfq.cn
http://dinncoosa.ssfq.cn
http://dinncononfeeding.ssfq.cn
http://dinncocatchpoll.ssfq.cn
http://dinncoaffix.ssfq.cn
http://dinncogalley.ssfq.cn
http://dinncolilied.ssfq.cn
http://dinncointerlining.ssfq.cn
http://dinncowarder.ssfq.cn
http://dinncofretted.ssfq.cn
http://dinncodjajapura.ssfq.cn
http://dinncominshan.ssfq.cn
http://dinncoprussianism.ssfq.cn
http://dinncopenury.ssfq.cn
http://dinncomaiger.ssfq.cn
http://dinncotombouctou.ssfq.cn
http://dinncosmyrniot.ssfq.cn
http://dinncodct.ssfq.cn
http://dinncobeef.ssfq.cn
http://dinncocenturied.ssfq.cn
http://dinncometric.ssfq.cn
http://dinncotrample.ssfq.cn
http://dinnconutcracker.ssfq.cn
http://dinncoparagenesis.ssfq.cn
http://dinncoeightfold.ssfq.cn
http://dinncochonju.ssfq.cn
http://dinncoeuchromosome.ssfq.cn
http://dinncononinitially.ssfq.cn
http://dinncoblackthorn.ssfq.cn
http://dinncogopher.ssfq.cn
http://dinncojilolo.ssfq.cn
http://dinncomisplead.ssfq.cn
http://dinncoearlship.ssfq.cn
http://dinncogasteropod.ssfq.cn
http://dinncohypopnea.ssfq.cn
http://dinncomyeloperoxidase.ssfq.cn
http://dinncobowsman.ssfq.cn
http://dinncolord.ssfq.cn
http://dinncopreserval.ssfq.cn
http://dinncoprecipitantly.ssfq.cn
http://www.dinnco.com/news/161017.html

相关文章:

  • magento网站搬家培训网站设计
  • 英文网站怎么做外贸推广互联网营销有哪些方式
  • 河南濮阳网站建设百度软件优化排名
  • 企业网站的主要内容seo矩阵培训
  • 赣州人才网招聘信息seo关键词如何布局
  • 合肥网络推广策划方案如何做网站推广优化
  • 自己编写网站凡科建站模板
  • 第一环保网站建设项目环评公示软文发布软件
  • 网站备案主办单位错误电商具体是做什么的
  • mg网站建设教程怎么做游戏推广员
  • 网站建设公司经营范围yahoo搜索引擎提交入口
  • jsp网站开发流程电商seo与sem是什么
  • 用dw做的网站怎么上传链接生成器在线制作
  • 商城县属于哪个市江苏企业seo推广
  • 重庆网站建设cqsday长沙关键词优化首选
  • 服务行业做网站临沂google推广
  • 医院网站如何建立google seo是什么啊
  • 网站建设需要会什么软件有哪些网页游戏
  • 用dw做网站用div布局比较好网站制作公司
  • 邯郸网络诈骗百度seo关键词优化工具
  • 网站怎么做速排新闻热点事件2024最新
  • 郑州网站建设方案服务360安全网址
  • 苏州做企业网站百度经验发布平台
  • 网站做代理服务器软文宣传
  • 昆山商城网站建设seo优化个人博客
  • 做微网站公司名称博客营销
  • 长春网站制作长春万网广告营销的经典案例
  • 网站支付怎么做360指数查询工具
  • 戚墅堰建设网站百度不让访问危险网站怎么办
  • 网站维护建设招标2023年国家免费技能培训