Mysql has been running slowly in the production environment recently, and some SQL statements are also slow, first, check whether showvariableslike 'slow _ query_log % 'is enabled for the slow query log. the showvariableslike 'long _ query_time %'
Chapter 4 MySQL database. Learning points: 1. web database Overview 2. mySQL operation 3. mySQL common functions 4. SQL statement details 5. phpMyadmin 1. web database Overview now, we are familiar with the basic knowledge of PHP
Learning points:
1.
Linux MySQL commands to: http://my.oschina.net/wangwang110/blog/11108
The database is under/var/lib/mysql by default.
1. commands for starting mysql in linux:Mysqladmin start/Etc/init. d/mysql start (the installation path of mysql is earlier)
2.
This article describes how to optimize data types in MySQL, including using multi-column indexes and other optimization methods. For more information, see
Select a type that facilitates efficiency
1. make your data as small as possible
One of the
This article mainly introduces how to release disk space after MysqlInnoDB deletes data. Innodb only marks deleted data as deleted and does not actually release the occupied disk space, this leads to the continuous growth of InnoDB database files.
Monty said MySQL optimization (II) VI. Optimization of applications
Focus on solving the problem.
When writing an application, you should decide what is the most important:
Speed
Portability between operating systems
Portability between SQL Servers
UPDATE statement speedThe optimization of update queries is the same as that of SELECT queries, and additional write overhead is required. The write speed depends on the size of the updated data and the number of updated indexes. Indexes that have
For more information, see Mysql.
Preface
The database has always been a weak place for me. I prefer to Use ORM to make a record based on my own experience (python + sqlalchemy, I have always felt that SQL spelling is a painful task (mainly because I
Start: net start mySql;Enter: mysql-u root-p/mysql-h localhost-u root-p databaseName;List databases: show databases;Select Database: use databaseName;List tables: show tables;Show columns from tableName;Create a database: source
1, make your data as small as possible
One of the most basic optimizations of is to make your data (and index) occupy as little space on disk (and in memory) as possible. This can be a huge improvement because disk reads faster and usually uses
2.1 Login to MySQL console [username is root, password defaults to NULL]
Switch to MySQL's Bin directory cd D:/wamp/mysql/bin
Login to MySQL Console
Syntax: mysql-h hostname-u username-p
Connecting to another host
Code: Mysql-h 192.168.1.1-u
I deleted part of the data:
mysql> Delete from pending_22 limit 1000;Query OK, 1000 rows Affected (2.99 sec)
But delete does not automatically free space, the table table space size is still before size: 30408704
To release the next space by
Convert IP addresses and numbers with MySQL built-in functions
Take advantage of two built-in functions
Inet_aton: Converts an IP address to a digital type
Inet_ntoa: Converts a numeric type to an IP address
Take full advantage of MySQL's
Every so often people ask me the question how should they the estimate memory consumption by MySQL Server in given Configurati On. What is the formula they could use.
People often ask me how to estimate memory consumption when I configure MySQL. So
1. Create a stored procedure2. Get all the table names in the database first3. Reclaim space using optimize table4. Execute the stored procedure (call Recycle_interspace)DELIMITER $$CREATE PROCEDURE ' Recycle_interspace ' ()BEGINDECLARE
If a MyISAM table contains any variable-length columns (VARCHAR, blobs, or textdynamic), or if a table is created with the row_format=dynamic option, the dynamic storage format is used.
This format is a bit more complicated, because each row has a
MySQL 5.5 DDLPrior to MySQL version 5.5, all DDL operations were done using copy table, which was not allowed to be written, read only, and introduced the FIC (Fast index creation) feature in MySQL version 5.5.FCI 操作流程:(1)对表加共享S锁,允许其他会话读操作,但禁止写操作,(2)
1.linux commands to start MySQL:Mysqladmin start/ect/init.d/mysql start (front of MySQL installation path)2.linux Restart MySQL command:Mysqladmin restart/ect/init.d/mysql Restart (front of MySQL installation path)3.linux the command to turn off
1.linux commands to start MySQL:Mysqladmin start/ect/init.d/mysql start (front of MySQL installation path)2.linux Restart MySQL command:Mysqladmin restart/ect/init.d/mysql Restart (front of MySQL installation path)3.linux the command to turn off
1. To optimize the query, avoid full-table scanning as far as possible, and first consider establishing an index on the columns involved in the Where and order by.2. You should try to avoid null values in the WHERE clause, otherwise it will cause
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.