03 Database Tuning

# Question
database tuning options?
# Answer
whatever database, data are stored in the hard disk, the hard disk is first read and write efficiency the decisive factor database access speed, for example, SSD and mechanical drive speed will have significantly different. In the case of the underlying physical storage medium is determined, the design of the database itself becomes a decisive factor, we continue to narrow the scope to mysql database to be discussed. The general principle is to select those fast execution speed appropriate statement or swap space and time, specific steps we can take at the level programmers are:
* Use the InnoDB storage engine, better concurrency, higher resource utilization
* UTF8 character set used, the risk of distortion-free and space-saving
* table must have a primary key
* elimination of external keys, foreign keys using Chengxukongzhi integrity constraints, to reduce or avoid the connection table
on the high distinction *, less update field established index
* Do not read the unneeded columns that do not use "the SELECT *"
* multi-use between, exists, "in" next, do not use "or"
* do not use fuzzy queries
* Do not use the functions on the column where the words
* sql statement capitalized
and so on.
In addition, the large amount of data to a certain extent, no matter what strategies are inadequate to take, we should avoid the presence of a large table, should the inevitable big table exists, should consider using mycat read and write separation and sub-library sub-table, and even use hbase and other big data technologies is also an option.

Guess you like

Origin www.cnblogs.com/alichengxuyuan/p/12594307.html