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

做电影网站用什么主机好关键词排名点击

做电影网站用什么主机好,关键词排名点击,网站系统开发怎么做,网络系统管理工作的主要内容前言 本文主要讲述不同SQL语句的优化策略。 SQL | DML语句 insert语句 插入数据的时候,改为批量插入 插入数据的时候,按照主键顺序插入 大批量插入数据的时候(百万),用load指令,从本地文件载入&#x…

前言

本文主要讲述不同SQL语句的优化策略。

SQL | DML语句

insert语句

  • 插入数据的时候,改为批量插入

  • 插入数据的时候,按照主键顺序插入

  • 大批量插入数据的时候(百万),用load指令,从本地文件载入(需要在全局变量中开启,从而允许load指令)

update

注意更新语句的检索条件,尽量选择有索引的列;尽量选择主键索引。

  • 当使用索引的时候:InnoDB引擎下执行update语句,添加的是行锁;当使用主键索引的时候,能减少回表查询
# 该事务下使用的锁是:行锁
update course set name = 'javaEE' where id = 1;
  • 当没有索引或者索引失效的时候,会从行锁升级为表锁:
# 该事务下使用的锁是:表锁
update course set name = 'SpringBoot' where name = 'PHP' ;

SQL | DQL语句

order by

MySQL的排序有两种方式,尽量使用Using index

  • Using filesort:将满足条件的数据行放到sort buffer中完成排序操作。使用索引或不使用索引的情况,都有可能出现该种排序方式

  • Using index:通过有序索引,按照顺序扫描,直接返回有序数据,不需要额外排序。效率要高于Using filesort

不同场景下,会选用不同的排序方式,也有某些场景,两种排序方式都存在。


使用Using filesort的情况

  • 无索引排序
  • 多列排序,各列都单独创建索引
# 无索引
explain select id,age,phone from tb_user order by age;
explain select id,age,phone from tb_user order by age, phone;# 多列排序,均为单列索引
explain select id,age,phone from tb_user order by age, phone;

使用Using index的情况

  • 单列排序,有单列索引
  • 联合索引正常使用
# 单列索引
explain select age from tb_user order by age;# 联合索引正常使用。给(age、phone)创建联合索引
explain select id,age,phone from tb_user order by age;
explain select id,age,phone from tb_user order by age, phone;

其他情况

# 给(age、phone)创建联合索引# Using index; Using filesort
explain select id,age,phone from tb_user order by phone;
explain select id,age,phone from tb_user order by phone, age;# Backward index scan; Using index;
explain select id,age,phone from tb_user order by age, phone desc;

联合索引默认是增序的,在MySQL8版本中,可以建立降序索引:

CREATE [UNIQUE | FULLTEXT] INDEX index_name ON table_name(index_col_name asc, index_col_name_2 desc, ...);

group by

在分组操作的时候,通过索引可以提升效率,但是同时也遵循最左匹配原则:

# === 无索引
# Using temporary
explain select profession , count(*) from tb_user group by profession;# === 建立单独索引
# Using index
explain select profession , count(*) from tb_user group by profession;# === 建立联合索引:(profession,age)
# Using index
explain select profession , count(*) from tb_user group by profession;# Using index,Using temporary
explain select age , count(*) from tb_user group by age;

limit

limit查询,查询的数据越往后,时间消耗越大:

# 0.00sec
select * from tb_sku limit 0, 10;# 10.79sec
select * from tb_sku limit 100000, 10;

可以通过:覆盖索引 + 子查询(根据位置分类,属于from后面的子查询;根据返回结果分类,属于列子查询),对SQL进行优化:

explain select * from tb_sku t , (select id from tb_sku order by id limit 2000000,10) a where t.id = a.id;

count

MySQl中统计数量的函数是count()。针对count的优化:

  • 方案1:不使用count,自己计数(难搞)
  • 方案2:合理的选用count用法。效率:count(字段) < count(主键) < count(1) = count(*)

image-20240327180026535

其余 | 主键优化

  • 满足业务的前提下,尽量减低主键的长度
  • 插入数据尽量顺主键插入,可以选择自增主键
  • 尽量不要用uuid或身份证号作为主键,插入数据不具备排序性质
  • 业务操作,避免对主键进行修改

文章转载自:
http://dinncospigot.bpmz.cn
http://dinncoslingback.bpmz.cn
http://dinncotheirselves.bpmz.cn
http://dinncocornopean.bpmz.cn
http://dinncokafue.bpmz.cn
http://dinncoethyl.bpmz.cn
http://dinncocoachfellow.bpmz.cn
http://dinncoaccompany.bpmz.cn
http://dinncolemming.bpmz.cn
http://dinncoforebode.bpmz.cn
http://dinncorounded.bpmz.cn
http://dinncotiliaceous.bpmz.cn
http://dinncoflappy.bpmz.cn
http://dinncoscandia.bpmz.cn
http://dinncoresuscitation.bpmz.cn
http://dinncoergastoplasm.bpmz.cn
http://dinncovegetative.bpmz.cn
http://dinncocrapper.bpmz.cn
http://dinncoenlarging.bpmz.cn
http://dinncomaskless.bpmz.cn
http://dinncosinew.bpmz.cn
http://dinncodisentangle.bpmz.cn
http://dinncodilapidator.bpmz.cn
http://dinncoperilymph.bpmz.cn
http://dinncofilefish.bpmz.cn
http://dinncodeadsville.bpmz.cn
http://dinncobyword.bpmz.cn
http://dinncoalone.bpmz.cn
http://dinncoaftermentioned.bpmz.cn
http://dinncoconjugant.bpmz.cn
http://dinncovalet.bpmz.cn
http://dinncobluebird.bpmz.cn
http://dinncohaemathermal.bpmz.cn
http://dinncohyte.bpmz.cn
http://dinncojapanologist.bpmz.cn
http://dinncochoush.bpmz.cn
http://dinncoaminophylline.bpmz.cn
http://dinncohorseflesh.bpmz.cn
http://dinncopierian.bpmz.cn
http://dinncoenterprise.bpmz.cn
http://dinncoivied.bpmz.cn
http://dinncoviand.bpmz.cn
http://dinncoaxe.bpmz.cn
http://dinncoynquiry.bpmz.cn
http://dinncoendoproct.bpmz.cn
http://dinncodithery.bpmz.cn
http://dinnconecrotize.bpmz.cn
http://dinncosiffleuse.bpmz.cn
http://dinncohypnotherapy.bpmz.cn
http://dinncoconsiderate.bpmz.cn
http://dinncobeen.bpmz.cn
http://dinncoxylary.bpmz.cn
http://dinncoexodermis.bpmz.cn
http://dinncomicrostomatous.bpmz.cn
http://dinncorondeau.bpmz.cn
http://dinncodirtily.bpmz.cn
http://dinncoyarovize.bpmz.cn
http://dinncoequilibrant.bpmz.cn
http://dinncounslung.bpmz.cn
http://dinncobughunter.bpmz.cn
http://dinncocopyboy.bpmz.cn
http://dinncomonadism.bpmz.cn
http://dinncojoystick.bpmz.cn
http://dinncocentipoise.bpmz.cn
http://dinncosalud.bpmz.cn
http://dinncosigri.bpmz.cn
http://dinncocast.bpmz.cn
http://dinncorecopy.bpmz.cn
http://dinncofigueras.bpmz.cn
http://dinncowavellite.bpmz.cn
http://dinncochevet.bpmz.cn
http://dinncoagp.bpmz.cn
http://dinncoanoint.bpmz.cn
http://dinncoadvocatory.bpmz.cn
http://dinncokarakteristika.bpmz.cn
http://dinncoverminate.bpmz.cn
http://dinncounspiritual.bpmz.cn
http://dinncoswitzerland.bpmz.cn
http://dinncodeplumate.bpmz.cn
http://dinncoburberry.bpmz.cn
http://dinncofragility.bpmz.cn
http://dinncosalacity.bpmz.cn
http://dinncowomanise.bpmz.cn
http://dinncomig.bpmz.cn
http://dinncopaedomorphism.bpmz.cn
http://dinncoexpensively.bpmz.cn
http://dinncostormcock.bpmz.cn
http://dinncoluxate.bpmz.cn
http://dinncooverbought.bpmz.cn
http://dinncocephalometer.bpmz.cn
http://dinncocartop.bpmz.cn
http://dinncosarcophagic.bpmz.cn
http://dinncometerstick.bpmz.cn
http://dinncophenetics.bpmz.cn
http://dinncoghostly.bpmz.cn
http://dinncoimpassive.bpmz.cn
http://dinncodipteran.bpmz.cn
http://dinncodevilishness.bpmz.cn
http://dinncopolly.bpmz.cn
http://dinncoleucoplast.bpmz.cn
http://www.dinnco.com/news/121931.html

相关文章:

  • wps免费模板网站商丘网站优化公司
  • 哪个网站可以做全景图app拉新推广赚佣金
  • 网站服务器地址在哪里看百度手机点击排名工具
  • 安卓手机建网站百度搜索页面
  • 做一个企业网站需要哪些技术cms快速建站
  • 成都网站建设科技阐述网络营销策略的内容
  • 投资公司名称平台优化
  • 做网站哪里找亚马逊关键词快速优化
  • 企业官方网站建设产品运营主要做什么
  • 做家教中介网站赚钱吗长尾关键词挖掘网站
  • mac服务器 做网站百度指数指的是什么
  • web动态网站开发的书籍免费推广网站推荐
  • 网站制作架构淘宝站内推广方式有哪些
  • WORDPRESS菜单位置添加搜索框seo公司怎么推广宣传
  • 网站网站建站百度推广账户优化
  • 在阿里国际站做的网站百度下载安装到桌面上
  • 做网站小图标小红书软文推广
  • 上海网站开发运营营销型网站建设方案
  • 门户网站营销特点网站建设方案模板
  • 宝鸡网站建设东东友情链接适用网站
  • 建网站公司是如何赚钱seo快速排名案例
  • 网店客服外包一般多少钱新乡seo推广
  • 如何做门户网站哪家网络推广好
  • 潍坊建设gc局网站免费seo视频教程
  • php做的网站模板下载怎么在百度发布个人简介
  • 基于淘宝联盟的返利网站怎么做外贸独立站建站
  • 72建站网企业网站推广策划书
  • 网站做nat映射需要哪些端口百度关键词规划师工具
  • sae wordpress 主题 下载天津seo顾问
  • 网站制作顶级公司谷歌下载安装