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

青海媒体网站建设公司整站系统

青海媒体网站建设公司,整站系统,苏州关键词优化seo,网站留言板制作转自#xff1a;http://www.0791quanquan.com/news_keji/topic_816453/探索一#xff1a;正负数问题拿tinyint字段来举例#xff0c;unsigned后#xff0c;字段的取值范围是0-255#xff0c;而signed的范围是-128 - 127。 那么如果我们在明确不需要负值存在的情况下#…转自http://www.0791quanquan.com/news_keji/topic_816453/探索一正负数问题拿tinyint字段来举例unsigned后字段的取值范围是0-255而signed的范围是-128 - 127。 那么如果我们在明确不需要负值存在的情况下通常是不要设置signed来支持负数的。 因为只支持正数会让存储空间大一倍呢(当然我这种表达可能不准确)。 假设我们使用tinyint来存储一些状态值。 0表示删除1表示待付款2表示已付款3...。 突然来个需求要加订单取消一些有代码洁癖的人就想那就将定义为-1表示取消吧。 但是就因为有了-1我们说起来应该可以从0存到255的结果就变为了0-127。 所以一般情况下我们不建议这样设置字段设置为unsigned后有一个问题是当select a - b from t时a为10b为12那么这时就会出现异常情况ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in (test.t.a - test.t.b)所以注意这种情况即可探索二性能问题严格讲在性能上是有细微的差别的。 unsigned的性能更好当只存储正整数的情况下。 因为当unsigned时假设查询值在500以下的数据那么MySQL会将范围定义为0-500而如果是signed则查询范围为-2147483648 - 500。 参考文章http://rakesh.sankar-b.com/2010/08/25/mysql-unsigned-int-to-signed-int-performance-tips-index/里面讲到Let’s say you want to know the list of customers who have purchased an item of quantity 500 or less. Following is the query you might be used to get these results:SELECT *FROM customerWHERE quantity  500Cool, the above query will yield you the list of customers who have purchased an item of quantity 500 or less. Right, what is the big deal, it should return fast, but consider when you have a table with millions of records then this query might be slow in returning you the results.Yes, that is true, you can always add an “ index ” to the “quantity” field and improve the performance – exactly, this should improve the performance of processing the query much better than without an “index”.Without “unsigned”:Process flow, since the quantity field is an “ int ” and you have an  index  of this field, MySQL  will define the range as  -2147483648 to 500  and it will get the result based on this range.With “unsigned”:Process flow, since the quantity field is an “ int ” with “ unsigned ” and you have an index of this field,  MySQL  will define the range as  0 to 500  and it will get the result based on this range.Now compare the difference yourself and tell me, for sure it will improve the performance of the your query. Since we know we never store any negative (signed values) in the quantity field and the default behavior of “ int ” is “ signed “, it’s always better to write a full-syntax while creating a table.总的说来设置unsigned最大的差异是字段取值范围的变化。 所以基于这点来对字段的unsigned或者signed是比较明智的决定以上参考文献http://verysimple.com/2006/10/22/mysql-data-type-optimization-tips/http://rakesh.sankar-b.com/2010/08/25/mysql-unsigned-int-to-signed-int-performance-tips-index/http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.htmlhttp://www.cnblogs.com/blankqdb/archive/2012/11/03/blank_qdb.html
http://www.pierceye.com/news/32956/

相关文章:

  • 网站租用服务器网站设计制作有哪些原因
  • 网站建设的相关新闻做网站项目收获
  • 哪建设网站中铁建设集团有限公司华南分公司
  • 做网站属软件什么专业wordpress编辑器没了
  • 网站方案书产品软文怎么写
  • uzi视频网站谁做的做网站一般多少钱
  • 橙色网站logo 配色企业运营管理名词解释
  • 网站开发技术考试试卷货运网站建设
  • ppt模板免费网页企业网站seo点击软件
  • 好听好记的网站域名洛阳霞光企业网站建设公司
  • 邢台做网站推广的地方2015军考网站建设
  • 网站建设企业如何为公司建设宁波外贸公司为什么这么多
  • 自建网站如何被百度收录仿站工具教程
  • 江苏省建设资格注册中心网站哪个网站做的系统好
  • 建设网站能挣钱吗做礼品的网站
  • 怎么申请免费国内免费网站WordPress文章付费系统
  • 西安网站推广建设怎样自己申请注册公司
  • 外贸移动商城网站开发免费表格模板下载
  • 营销型网站建设怎么做网站模板ftp
  • 做同城信息网站怎么赚钱成都网站建设 lkcms
  • 北京网站开发浩森宇特云空间网站
  • 网站建设vipjiuselu做一个微信小程序商城需要多少钱
  • 尚义网站建设wl17581常用的网站推广
  • 苏宿工业园区网站建设成功案例怎么看网站是什么时候做的
  • 重庆工厂网站建设云南网页设计与制作
  • 九江市建设工程质量监督站网站城市建设法规考试网站
  • 全国送花网站河南建一个网站大概要多少钱
  • 网站图标按钮用什么做昆明网站建设培训
  • 深圳微商城网站设计价格昆明网页建站平台
  • 广州企业建站网站医药电商网站建设