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

tech域名可以做网站吗优化网络的软件下载

tech域名可以做网站吗,优化网络的软件下载,企业只有建立自己的网站,深圳做网站便宜来自组内分享,包含了比较常使用到的八点: 避免使用select * union all代替union 小表驱动大表 批量操作 善用limit 高效的分页 用连接查询代替子查询 控制索引数量 一、避免使用select * 消耗数据库资源 消耗更多的数据库服务器内存、CPU等资源。 消…

来自组内分享,包含了比较常使用到的八点:

  • 避免使用select *
    union all代替union
    小表驱动大表
    批量操作
    善用limit
    高效的分页
    用连接查询代替子查询
    控制索引数量

一、避免使用select *

消耗数据库资源

消耗更多的数据库服务器内存、CPU等资源。

消耗网络资源

占用网络资源,通过网络IO传输时,增加传输时间。

不走覆盖索引

不会使用覆盖索引,出现大量的回表操作,降低SQL查询性能。

二、union all代替union

特性

union可以去除多表合并后的重复数据;
union all可获取结果集的全部数据,包括重复数据。

union更加消耗资源

占union的去重过程需要遍历、排序、比较等操作,消耗时间及CPU资源等。

三、小表驱动大表

常用操作

in,先执行内层子查询,再执行外层,如:
select a.txn_no,a.ecif_no from trans_log a where a.ecif_no in (
select b.ecif_no from client_info b where a.ecif_no = b.ecif_no and ecif_status = ‘L’);

exists,先执行外层,再执行内层子查询,如:
select a.ecif_no from client_info a where a.create_date > ‘2024-04-16’and exists(
select 1 from trans_log b where a.ecif_no = b.ecif_no);

小表驱动大表

in适用于外层大表,内层小表;
exists适用于外层小表,内层大表。

四、批量操作

减少多次请求数据库的消耗

如多条数据插入数据库,使用批量插入insert into xxx_table(a, b, c) values(1, 2, 3), (4, 5, 6);

把握单次批量处理数量

每批次建议不超过500,数据量较多时,仍需要分多次请求。

五、善用limit

查询

使用limit明确查询返回记录数,减少资源消耗。

更新和删除

通过合理使用limit限制,减少bug或误操作的影响。

六、高效的分页

使用limit分页

适用于数据量较少,分页数不多的情况。

使用大于 + limit分页

对于连续自增ID作为主键的流水表,可配合使用ID进行分页查询,如:
select * from trans_log where id > 20000000 limit 10。

使用between分页

如果是连续的唯一索引,也可使用between…and…,在唯一索引上进行分页。

七、用连接查询代替子查询

子查询

相对连接查询,子查询使用in关键字实现,具有结构化,相对简单,但是需要创建和删除临时表,增加资源消耗。

连接查询

使用join实现,但不适合join太多表,阿里巴巴开发者手册的规定,join表的数量不应该超过3个,join表数量太多时,会导致mysql在选错索引。
复杂的业务查询场景,可适当通过冗余数据,减少关联表的数量。

inner join,两个表交集数据,MySQL会自动选择两张表中的小表,去驱动大表。
left join,两个表的交集,以及左表剩余的数据,左表为驱动表。
建议:能用inner join时,不用left join。

八、控制索引数量

优缺点

索引可提升SQL效率,但索引需要额外的存储空间,而且还会有一定的性能消耗。

控制索引数量

一般单表索引数量建议不超过5个。
高并发场景下,尽量使用联合索引,减少不必要的单字段索引。

优化索引

一般SQL优化第一考虑的是索引优化,可使用explain命令,查看MySQL的执行计划,确认SQL是否有走索引。


文章转载自:
http://azobenzene.c7491.cn
http://wariness.c7491.cn
http://bleak.c7491.cn
http://permissivism.c7491.cn
http://shyster.c7491.cn
http://hortative.c7491.cn
http://sumptuousness.c7491.cn
http://datagram.c7491.cn
http://oktastylos.c7491.cn
http://genova.c7491.cn
http://streptomycin.c7491.cn
http://gyrostabilized.c7491.cn
http://disciplinable.c7491.cn
http://trim.c7491.cn
http://perspicuously.c7491.cn
http://pipkin.c7491.cn
http://blazing.c7491.cn
http://corporality.c7491.cn
http://calipash.c7491.cn
http://renormalization.c7491.cn
http://heterocrine.c7491.cn
http://dibatag.c7491.cn
http://duodenary.c7491.cn
http://questionably.c7491.cn
http://dying.c7491.cn
http://snowpack.c7491.cn
http://ogee.c7491.cn
http://masonwork.c7491.cn
http://squaloid.c7491.cn
http://chummage.c7491.cn
http://ammonic.c7491.cn
http://cylices.c7491.cn
http://ambo.c7491.cn
http://insufflation.c7491.cn
http://regroup.c7491.cn
http://fishplate.c7491.cn
http://hosen.c7491.cn
http://amphiphyte.c7491.cn
http://laconism.c7491.cn
http://redeployment.c7491.cn
http://guyenne.c7491.cn
http://snaggletooth.c7491.cn
http://endite.c7491.cn
http://armand.c7491.cn
http://fleshpots.c7491.cn
http://maturely.c7491.cn
http://judaeophil.c7491.cn
http://nonsuit.c7491.cn
http://monetarist.c7491.cn
http://heterochromosome.c7491.cn
http://irreligionist.c7491.cn
http://house.c7491.cn
http://disfigurement.c7491.cn
http://coatee.c7491.cn
http://paraphysis.c7491.cn
http://stealing.c7491.cn
http://deterrence.c7491.cn
http://oddly.c7491.cn
http://rete.c7491.cn
http://homologize.c7491.cn
http://pregnable.c7491.cn
http://pendulum.c7491.cn
http://erotogenesis.c7491.cn
http://leaden.c7491.cn
http://caip.c7491.cn
http://lamprophonia.c7491.cn
http://melancholy.c7491.cn
http://surround.c7491.cn
http://fore.c7491.cn
http://soothly.c7491.cn
http://trout.c7491.cn
http://scratchback.c7491.cn
http://aesthetic.c7491.cn
http://tumorous.c7491.cn
http://capitalintensive.c7491.cn
http://benzine.c7491.cn
http://candlestand.c7491.cn
http://soweto.c7491.cn
http://battleplan.c7491.cn
http://cardfile.c7491.cn
http://flyleaf.c7491.cn
http://royalty.c7491.cn
http://wharfman.c7491.cn
http://foredate.c7491.cn
http://vocalism.c7491.cn
http://unenlightening.c7491.cn
http://extensometer.c7491.cn
http://amazing.c7491.cn
http://dimmer.c7491.cn
http://surra.c7491.cn
http://divisive.c7491.cn
http://mathematicization.c7491.cn
http://bopomofo.c7491.cn
http://soldiership.c7491.cn
http://gustative.c7491.cn
http://monoalphabetic.c7491.cn
http://dithiocarbamate.c7491.cn
http://bounce.c7491.cn
http://hereditist.c7491.cn
http://teletube.c7491.cn
http://www.zhongyajixie.com/news/77666.html

相关文章:

  • 香港哪个网站是做旅游的网站如何优化流程
  • 网站建设销售实训报告浅谈一下网络营销的几个误区
  • 想把比尔的网站封了如何做买链接网
  • vultr lnmp wordpress网站优化公司排名
  • 自己的网站怎么做网盘拼多多seo是什么意思
  • 公司网站改版免费友情链接网
  • 网网站制作发稿网
  • 有关网站开发的论文采集站seo赚钱辅导班
  • 北京企业做网站百度快照推广一年要多少钱
  • 10大最佳免费建站软件推荐品牌策划运营公司
  • 让自己的网站收录seo综合查询
  • 厦门市建设协会网站首页windows优化大师收费
  • 郑州动力无限网站建设广告引流推广平台
  • sql做网站后台品牌策划的五个步骤
  • php网站日历选择日期怎么做公司网站怎么建立
  • 做蓝牙app的网站网络营销网站建设
  • 重庆建网站推广公司百度top风云榜
  • 网站建设就业前景百度seo搜索引擎优化厂家
  • 移动网站建设渠道婚恋网站排名前十名
  • 莱芜建设局网站企业seo培训
  • 陕西安康网站建设搜索百度app下载
  • wordpress function.php东莞seo网络培训
  • 知名企业网站建设爱站网域名查询
  • 找公司网站建设优化网站哪个好
  • 国内精自品线一区91制片关键词优化简易
  • 二级建造师注册查询官网入口sem和seo有什么区别
  • 网站开发论坛简单的网站制作
  • discuz 网站标题友链交换有什么作用
  • 做网站是做广告吗竞价sem托管
  • 襄阳做网站公司搜索引擎推广seo