mariadb

读薄《高性能MySql》(四)查询性能优化

强颜欢笑 提交于 2020-04-22 04:34:24
读薄《高性能MySql》(一)MySql基本知识 读薄《高性能MySql》(二)Scheme与数据优化 读薄《高性能MySql》(三)索引优化 读薄《高性能MySql》(四)查询性能优化 对 MySql 进行优化,必须对 Scheme,索引,查询语句一同优化。 通过前面的章节我们掌握了 Scheme 和 索引的优化,最后我们来看一下查询优化。 为了优化查询,我们必须先了解查询是怎样执行的,然后探讨优化器在哪些方面做得还不足,以帮助 MySql 更有效的执行查询。 #优化数据访问 在一条 Sql 语句执行的很慢的时候,可以从以下两个方面来分析: 是否在检索的时候访问了太多的行或者列 MySql 服务器是否在分析大量超过需要的行 请求了不需要的数据 ###万恶之源 SELECT * 一个很好用的观点就是在每次使用 SELECT * 取出全部行的时候都要审视一下自己是否需要全部数据。 取出所有列可能使得索引覆盖无效,一些 DBA 是严格禁止 SELECT * 的写法的。 重复查询数据 有些地方可能会不小心的重复查询了相同的数据。比如在论坛中,如果一个人回复多次,很有可能会一不小心每次都去请求这个人的资料,一个有效的方法就是使用缓存。 扫描额外的记录 确定查询只返回需要的数据以后,接下来该看一下为了返回需要的记录是否扫描了太多行了。有两个指标我们需要关注,一个是扫描的行数和返回行数的比值

第十七周

心已入冬 提交于 2020-04-22 00:44:41
1、部署分离的LAMP,部署到二台服务器上,php加载xcache模块 1、环境: 两台机器: 192.168.43.137 httpd php-fpm php-mysql 192.168.43.108 mariadb 2、137上安装httpd、 php-fpm 、php-mysql [root@ka2 conf.modules.d]#yum install httpd php-fpm php-mysql 3、创建session目录,确保运行php-fpm进程的用户对session目录有读写权限 [rot@ka2 conf.modules.d]#mkdir /var/lib/php/session [root@ka2 conf.modules.d]#chown apache.apache /var/lib/php/session 4、创建httpd的fcgi配置文件,将访问.php文件指定到具体目录 : [root@ka2 conf.modules.d]#vim /etc/httpd/conf.d/fcgi.conf DirectoryIndex index.php ProxyRequests Off ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/var/www/html/$1 5、验证http是否支持fcgi [root

Python全栈 MySQL 数据库 (简述 、安装、基本命令)

邮差的信 提交于 2020-04-21 04:02:38
ParisGabriel 每天坚持手写 一天一篇 决定坚持几年 为了梦想为了信仰   开局一张图 一个月的python已经结束了 下面就是数据库了 先说MySQL 这个数据库应该差不多是用户量最多的了 MySQL概述: 1.什么是数据库:      存储数据的厂库 2.有哪些公司在用数据库    金融 机构、 游戏 网站、 购物 网站、 论坛 网站... 3.提供 数据库 服务的 软件 :     1.软件的分类:        MySQL、Oracle、SQL_Server、DB2、MongoDB、MariaDB     2.生产环境中,如何 选择 使用哪些 数据库 软件:        1.是否开源         1.开源软件:MySQL、Mariadb、MongoDB         2.商业软件:Oracle、DB2、SQL_Server        2.是否跨平台         1.不过平台:SQL_Server         2.跨平台:......         3.公司的类型:      商业软件 :政府部门、金融机构      开源软件 :游戏网站、购物网站、论坛网址站 4.MySQL的特点:    1.关系型数据库     1.关系型数据库的特点       1.数据是 以行和列 ( 表格 )的形式 存储的       2.表格到的每 一行是一条记录

mysql的行格式

倾然丶 夕夏残阳落幕 提交于 2020-04-19 11:34:16
mysql数据是以行的形式存储在数据页中,行与行之间形成一个长的链表。 一行的数据除了insert into xxx values ();插入的数据外还存储了其他的数据信息,但是在执行client连接数据库查询数据时不会显示。 mysql行的格式有Compact,Redundant,Dynamic,Compressed四种,mysql5.5以上的默认compact格式, 查看系统的row_format格式 MariaDB [(none)]> show variables like 'innodb_%format'; +--------------------+----------+ | Variable_name | Value | +--------------------+----------+ | innodb_file_format | Antelope | +--------------------+----------+ 创建表的时候可以指定 row_format=compact 行数据存储compact格式 一、变长字段长度列表 几个点了解一下: 何谓变长?就是不定长。不定长从两个点理解: 字符集与属性类型 变长类型示例: varchar 、 varbinary 、 text 、 blob 这些变长列的实际占用字节数以 逆序 方式存储在 变长字段长度列表 中 逆序就是

在一台Linux服务器上安装多个MySQL实例(一)--使用mysqld_multi方式

北城余情 提交于 2020-04-19 04:35:27
(一)MySQL多实例概述 实例是进程与内存的一个概述,所谓MySQL多实例,就是在服务器上启动多个相同的MySQL进程,运行在不同的端口(如3306,3307,3308),通过不同的端口对外提供服务。 由于MySQL在一个实例下面可以创建多个数据库,所以通常在一台服务器上只要安装一个MySQL实例即可满足使用。但在实际使用中,因为服务器硬件资源充足,或者业务需要(比如在一台服务器上创建开发数据库和测试数据库),往往会在一台服务器上创建多个实例。 (二)MySQL部署多实例的方法 MySQL多实例部署主要有以下两种方式: 使用官方自带的mysqld_multi来配置管理,特点是使用同一份MySQL配置文件,这种方式属于集中式管理,管理起来较为方便; 使用单独的MySQL配置文件来单独配置实例,这种方式逻辑简单,数据库之间没有关联。 本文将对第一种方式进行环境搭建学习。 (三) 实验环境 操作系统 :CentOS Linux release 7.4.1708 (Core) 数据库版本:5.7.24-log 预计划安装4个MySQL实例,规划信息为: 实例1 实例2 实例3 实例4 basedir=/usr/local/mysql datadir=/mysql/3306/data port=3306 socket=/tmp/mysql_3306.sock basedir=/usr

Why mysql.connector works without problem with python2.7 and not with python3?

蓝咒 提交于 2020-04-18 05:45:35
问题 I checked different post like: Is there a way to use 'pool_reset_connection' from mysql-connector-python with MariaDB 10.4.7? But I can't solve my isue, I have a program write in python 2.7; now I'm moving everything to python 3 but I got problems with mysql.connector. In this moment I'm using python 3.8.2 and mysql-connector-python==8.0.19 but I try with different version of python 3, but I was getting always the same error on mysql.connector when I try to close the connection. Traceback

How to read data from mariadb using Spark java

孤者浪人 提交于 2020-04-16 03:52:11
问题 I need to read a table from MariaDB by using Spark and Java. I wrote a Java code for read table data from database.The connection is established successfully but it produces an error while reading the data. I am trying to read the table data as a dataframe. But the column name is shown as column value in result. find the code given below: import java.io.IOException; import java.io.InputStream; import java.util.Properties; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Row;

MariaDB官方手册翻译

≯℡__Kan透↙ 提交于 2020-04-13 18:34:19
【今日推荐】:为什么一到面试就懵逼!>>> MariaDB官方手册 翻译:create database语句(已提交到MariaDB官方手册) 翻译:rename table语句(已提交到MariaDB官方手册) 翻译:alter table语句(已提交到MariaDB官方手册) 翻译:标识限定符(已提交到MariaDB官方手册) 翻译:标识符命名规则(已提交到MariaDB官方手册) 翻译:database()(已提交到MariaDB官方手册) 翻译:set names(已提交到MariaDB官方手册) 翻译:锁等待超时时间wait/nowait(已提交到MariaDB官方手册) 翻译:设置字符集和排序规则(已提交到MariaDB官方手册) 翻译:set password(已提交到MariaDB官方手册) 翻译:XtraDB/InnoDB Storage Format(已提交到MariaDB官方手册) 翻译:XtraDB/InnoDB File Format(已提交到MariaDB官方手册) 翻译:set Variable(已提交到MariaDB官方手册) 翻译:赋值操作符(:=)(已提交到MariaDB官方手册) 翻译:last_value()函数(已提交到MariaDB官方手册) 翻译:group_concat()函数(已提交到MariaDB官方手册) 翻译:set子句

Navicat 密码加密算法

房东的猫 提交于 2020-04-13 14:33:45
【今日推荐】:为什么一到面试就懵逼!>>> How Does Navicat Encrypt Password? This repo will tell you how Navicat encrypts password and offer a tool to reveal passwords encrypted by Navicat. 1. What is Navicat? Navicat is a series of graphical database management and development software produced by PremiumSoft CyberTech Ltd. for MySQL, MariaDB, Oracle, SQLite, PostgreSQL and Microsoft SQL Server. It has an Explorer-like graphical user interface and supports multiple database connections for local and remote databases. Its design is made to meet the needs of a variety of audiences, from database administrators and

Navicat 密码加密算法

我怕爱的太早我们不能终老 提交于 2020-04-13 09:09:27
How Does Navicat Encrypt Password? This repo will tell you how Navicat encrypts password and offer a tool to reveal passwords encrypted by Navicat. 1. What is Navicat? Navicat is a series of graphical database management and development software produced by PremiumSoft CyberTech Ltd. for MySQL, MariaDB, Oracle, SQLite, PostgreSQL and Microsoft SQL Server. It has an Explorer-like graphical user interface and supports multiple database connections for local and remote databases. Its design is made to meet the needs of a variety of audiences, from database administrators and programmers to