MySQL manual version 5.0.20-MySQL optimization (IV) (1) (5) _ PHP Tutorial

Source: Internet
Author: User
MySQL manual version 5.0.20-MySQL optimization (4) (1) (5 ). Generally, all redundant data (the third paradigm in Database Principles) should be stored ). However, in order to achieve higher efficiency, copying some information or creating a summary table is also common. all redundant data should be stored (in database principles, it is called the "third Paradigm "). However, it is cost-effective to copy some information or create a summary table for higher efficiency.


The stored procedure or UDFs (user-defined functions) method may have higher performance when executing some tasks. However, when the database does not support these features, there are other alternative methods to achieve the goal, even if they are a little slow.


You can obtain results from the query cache or response, and then put many insert and update operations together. If the database supports table locks (such as MySQL and ORACLE), this ensures that the index cache only needs to be refreshed once after all update operations.


Insert delayed can be used when data is not written into the table. This will increase the speed because multiple records are simultaneously written to the disk.


INSERT LOW_PRIORITY is used when the SELECT statement has a higher priority than the INSERT operation.


SELECT HIGH_PRIORITY is used to skip the query records queue. that is to say, even if other clients are about to write data, the SELECT statement is executed first.


Multiple record insertion formats are used in an INSERT statement (supported by many databases ).


Use load data infile to import a large amount of DATA, which is faster than INSERT.


Use the AUTO_INCREMENT field to generate unique values.


Regularly execute optimize table to prevent fragments from being generated from MyISAM tables in the dynamic record format. For details, see "15.1.3 MyISAM Table Storage Formats ".


The HEAP table may increase the speed. For details, see "15.1.3 MyISAM Table Storage Formats ".


In normal WEB server configuration, it is best to store image files as files, and only store the file index information in the database. The reason for this is that, in general, the WEB server always performs better on the file cache than the database, so using file storage will make the system easier and faster.

Commit (in database principles, it is called the third paradigm "). However, to achieve higher efficiency, copying some information or creating a summary table is also...

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.