首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

告别一步一步来,你们一起上好了

随着互联网的高速发展,企业的数字化改革与精细化运营,均对数据库能力提出了越来越高的要求,数据分析能力、异构数据处理能力等愈发重要。公司各类报表整合,年终数据盘点,分析预测等越来越多的业务开始需要进行复杂查询。 并且,爆炸性的数据量增长也使得传统的数据库能力难以应对。企业的很多业务将对数据的实时性和效率性要求越来越高,想一想你的企业是否也是这样: 想!更早更快的在数据中识别和阻断漏洞,保证业务平稳运行; 想!更快更准的定位数据,提升服务效率; 想!更多更丰富的指标和计算口径,实现业务的快速增长; 但,多数的

02
您找到你想要的搜索结果了吗?
是的
没有找到

mysql优化3

1.5 query_cache_size (1)简介: 查询缓存简称QC,使用查询缓冲,mysql将查询结果存放在缓冲区中,今后对于同样的select语句(区分大小写),将直接从缓冲区中读取结果。 一个sql查询如果以select开头,那么mysql服务器将尝试对其使用查询缓存。 注:两个sql语句,只要想差哪怕是一个字符(列如大小写不一样;多一个空格等),那么这两个sql将使用不同的一个cache。 (2)判断依据 mysql> show status like "%Qcache%"; +-------------------------+---------+ | Variable_name | Value | +-------------------------+---------+ | Qcache_free_blocks | 1 | | Qcache_free_memory | 1031360 | | Qcache_hits | 0 | | Qcache_inserts | 0 | | Qcache_lowmem_prunes | 0 | | Qcache_not_cached | 2002 | | Qcache_queries_in_cache | 0 | | Qcache_total_blocks | 1 | +-------------------------+---------+ 8 rows in set (0.00 sec)

01

MySQL常用命令

启动:net start mySql; 进入:mysql -u root -p/mysql -h localhost -u root -p databaseName; 列出数据库:show databases; 选择数据库:use databaseName; 列出表格:show tables; 显示表格列的属性:show columns from tableName; 建立数据库:source fileName.txt; 匹配字符:可以用通配符_代表任何一个字符,%代表任何字符串; 增加一个字段:alter table tabelName add column fieldName dateType; 增加多个字段:alter table tabelName add column fieldName1 dateType,add columns fieldName2 dateType; 多行命令输入:注意不能将单词断开;当插入或更改数据时,不能将字段的字符串展开到多行里,否则硬回车将被储存到数据中; 增加一个管理员帐户:grant all on *.* to user@localhost identified by "password"; 每条语句输入完毕后要在末尾填加分号';',或者填加'\g'也可以; 查询时间:select now(); 查询当前用户:select user(); 查询数据库版本:select version(); 查询当前使用的数据库:select database(); 1、删除student_course数据库中的students数据表: rm -f student_course/students.* 2、备份数据库:(将数据库test备份) mysqldump -u root -p test>c:\test.txt 备份表格:(备份test数据库下的mytable表格) mysqldump -u root -p test mytable>c:\test.txt 将备份数据导入到数据库:(导回test数据库) mysql -u root -p test 3、创建临时表:(建立临时表test_temp) create temporary table test_temp(name varchar(10)); 4、创建表是先判断表是否存在 create table if not exists students(……); 5、从已经有的表中复制表的结构 create table table2 select * from table1 where 1<>1; 6、复制表 create table table2 select * from table1; 7、对表重新命名 alter table table1 rename as table2; 8、修改列的类型 alter table table1 modify id int unsigned;//修改列id的类型为int unsigned alter table table1 change id sid int unsigned;//修改列id的名字为sid,而且把属性修改为int unsigned 9、创建索引 alter table table1 add index ind_id (id); create index ind_id on table1 (id); create unique index ind_id on table1 (id);//建立唯一性索引 10、删除索引 drop index idx_id on table1; alter table table1 drop index ind_id; 11、联合字符或者多个列(将列id与":"和列name和"="连接) select concat(id,':',name,'=') from students; 12、limit(选出10到20条)<第一个记录集的编号是0> select * from students order by id limit 9,10; 13、MySQL不支持的功能 事务,视图,外键和引用完整性,存储过程和触发器 14、MySQL会使用索引的操作符号 <,<=,>=,>,=,between,in,不带%或者_开头的like 15、使用索引的缺点 1)减慢增删改数据的速度; 2)占用磁盘空间; 3)增加查询优化器的负担; 当查询优化器生成执行计划时,会考虑索引,太多的索引会给查询优化器增加

01

扫码

添加站长 进交流群

领取专属 10元无门槛券

手把手带您无忧上云

扫码加入开发者社群

相关资讯

热门标签

活动推荐

    运营活动

    活动名称
    广告关闭
    领券