Optimizing database table structure reasonably and improving project execution efficiency [database design]

Source: Internet
Author: User

  1. database table Design optimization :

    Sometimes in order to improve the efficiency of the database, we can properly consider the inverse three paradigms, add redundant fields appropriately, and reduce multi-table to correlate queries .

  2. Use index :

    2.1 database table design should be reasonable to use Ordinary index, primary key index, unique index, full - text index and composite (combined ) index.

    2.2 when to create an index:

    (1) A field that is more frequent as a query condition ;

    (2) The uniqueness of the field is too poor ( such as the Gender/Status field, etc. ), even if we frequently as a condition of the query, not fit to create the index;

    (3) Data update very frequently fields (such as the statistics platform current online person Number field/Item sales quantity fields, etc.) is not suitable to create an index.

    2.3 Use of specific indexes see: http://yaowusheng.blog.51cto.com/11020801/1853754

Note: Creating an index is cost-intensive, takes up a certain amount of disk space, and the index data is difficult to move; to maintain the index file, it can cause the increment, delete, change the operation to be slow, do not overuse the index, the reasonable use index is very important.


3. Select the appropriate MySQL storage engine:

3.1 MyISAM Storage Engine
If the table on the transaction requirements are not high, but also to query and add the main, consider MyISAM storage engine (such as BBS posting table and reply table);
3.2 InnoDB Storage Engine
High transaction requirements, stored data are important data, it is recommended to use the InnoDB storage engine (such as Account form, order form, etc. important table);
3.3 Memory Storage Engine
Data changes frequently, do not need storage, but also frequent query and modification, you can consider using Memory storage engine ( Note: The inserted data will not be persisted to disk space, but temporarily saved in memory, the data will be lost when closed );







This article is from the "Yao Technology blog" blog, make sure to keep this source http://yaowusheng.blog.51cto.com/11020801/1853695

Optimizing database table structure reasonably and improving project execution efficiency [database design]

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.