problem by reducing the scenario of table reconstruction and table lock, but this method cannot cover all possible operations, for example, when modifying the Data Type of a column, full table reconstruction is required. Przemysaw and malkoski discussed how to modify the definition in Mysql5.6 last year in as much detail as possible.
With the new features of
may find that MyISAM is faster than InnoDB because MyISAM only caches indexes, while InnoDB caches data and indexes. MyISAM does not support transactions. However, if you use innodb_flush_log_at_trx_commit = 2, you can achieve close read performance (a hundred times different ).1.1 How to convert an existing MyISAM database to InnoDB:
mysql -u [USER_NAME] -p -e "SHOW TABLES IN [DATABASE_NAME];" | tail -n +
Tags: self tuning update img tells control ATI tle storage EngineMySQL optimization in three directions ① optimize MySQL Server Core (this optimization is usually done by operations personnel). ② tuning MySQL configuration parameters (my.cnf) This optimization requires a stress test to adjust the parameters. ③ to SQL statements and table optimizations.
the following query results:Third, sub-query:Role: In some cases, when making a query, the condition required is the result of another SELECT statement, which is the time to use a subquery.Definition: The query (internal query) executed first to provide data to the main query (external query) is called a subquery. In other words, the subquery is executed first, and then the main query is executed based on the results of the subquery.Keywords: the keywords used for subqueries mainly include in,
# MySQL read into buffer size. A request to sequentially scan a table allocates a read-in buffer, and MySQL allocates a memory buffer for it. The read_buffer_size variable controls the size of this buffer.
# If the sequential scan requests to the table are very frequent and you think that frequent scans are going
resulting indexes is quite a bit bigger. Some of that was due to the larger primary key, but Some of it was undoubtedly due to page splits and resultant fra Gmentation as well. 2. Why is there a difference in the primary key succession? Insertion of successive primary keys Insertion of discontinuous primary keys Disadvantages of inserting discontinuous primary keys: The destination page might has been flushed to disk and removed from the caches, or might not having ever been placed into the
when it is federated.8, Sub_part If the column is only partially indexed, the number of characters that are indexed. Null if the entire column is indexed.9. Packed indicates how keywords are compressed. Null if it is not compressed.10, NULL if the column contains null, it contains Yes. If not, the column contains No.11, Index_type used Index method (btree consecutive reading data, hash suitable for random reading data, rtree suitable for a data to find nearby data).12. Commentary on CommentShow
Tags: database table programmer Server TipsWhen we design the database table structure, we need to pay attention to the performance of the data operation when we operate the database, especially the SQL statements when we look at the table. Here, we're not going to talk too much about optimizations for SQL statements,
increase, but the actually useful data rows are actually more solid. Therefore, the overall performance is improved. According to some opinions on the Internet, this method can be increased by dozens of times.
However, I have also seen several other methods on the Internet, such as preprocessing SQL statements and batch submission. So what is the performance of these methods? This article will compare thes
get the data (queries) you want in the format you want. Complex applications can have complex patterns and queries. If you want the performance and extensibility your application needs, you can't just rely on intuition to understand how to execute a query. You should learn how to use explain commands instead of random guesses and imaginations. This command shows how to execute the query and let you know what
One, Zoning Concepts
partitions allow multiple portions of a single table to be allocated across the file system according to the specified rules. Different parts of the table are stored as separate tables in different places. MySQL has been supporting partition from 5.1.3.
Partitioning and manual table comparisons
MYSQL: SQL _CALC_FOUND_ROWS and count (*) performance comparison bitsCN.com
1. create a table:
// Overwrite the index create table if not exists 'Ben' ('A' int (10) unsigned not null AUTO_INCREMENT, 'BB' int (10) unsigned not null, 'CC' varchar (100) not null, primary key ('A'), KEY 'bar' ('BB ', 'A') ENGINE = MyISAM;
We will discuss another aspect of database performance optimization, that is, using the built-in tools of the database server to assist in performance analysis and optimization. ▲Run the following command on SHOW to check the running status of the server: mysqlshowstatus. this command displays a long column of status variables and their corresponding values, including the number of users who have been abort
] mysqldump [Options]--databases [options] DB1 [DB2 DB3] ... mysqldump [Options]--all-databases [options] 1 "MyISAM engine, can directly copy data sheet. 2 "mysqldump: Data export to SQL statement 3 "SELECT * FROM table1 to outfile '/tmp/table1.txt '; 4 "Recovery: Load Data infile '/tmp/table1.txt ' into table table1; 4,mysqlimport Mysqlimport [OPTIONS] Database textfile ... The Mysqlimport program is a tool program that will store text data in a
Label:1. Optimizing queries for query caching When many of the same queries are executed multiple times, the results of these queries are placed in a cache so that subsequent identical queries do not have to manipulate the table directly to access the cached results. 2. EXPLAIN SELECT Query Use the EXPLAIN keyword to know how MySQL handles SQL statements. This can query the
MySQL explanation for this option:Tmp_table_sizeThis variable determines the maximum size for a temporary table in memory. If the table becomes too large, a MYISAM table is created on disk. Try to avoid temporary tables by optimizing the queries where possible, and where this is not possible, try to ensure
MySQL performance optimization and mysql Optimization
How to extract a random entry from a data table in MySQL, while ensuring the highest efficiency.
Method 1This is the most primitive and intuitive syntax, as shown below:SELECT * FROM foo order by rand () LIMIT 1This metho
because the return of these functions is variable. So all you need to do is use a variable instead of the MySQL function to turn on the cache.2. EXPLAIN your SELECT queryUse the EXPLAIN keyword to let you know how MySQL handles your SQL statements. This can help you analyze the performance bottlenecks of your query statement or
area size or using the local management table space. If a spatial allocation is a temporary tablespace, you can specify a true temporary tablespace (if the space allocation is occurring on the temp tablespace and then use a true temporary TA Blespace for the temp. )。A change in the 4>.dc_sequences value indicates whether a large number of sequence are being gene
default. As of 5.1.21 and the version with the Google patch installed, this option can be set in microseconds. this is a great feature, because once you have eliminated all queries whose query time exceeds 1 second, the adjustment is very successful, which helps you eliminate the problem SQL before the problem increases.
3. log_queries_not_using_indexes
Enabling this option is a good idea. it actually records the query that returns all rows.
Summary
We have introduced five categories of
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.