There is a large amount of field data in MySQL, but need to read the summary of this field?

Source: Internet
Author: User
There is a large amount of data in the MySQL table, but a summary of the field needs to be read.
For example, this field is primarily used to store articles, and this field of all records for this table is very long.

The efficiency of the Select Title,content from article when querying is much worse than the select title from article.

The previous practice was to read the Content field directly and then use the function to intercept it as a summary of the article.

Now think of a way to save two fields, content fields and content summary fields, but if the content is edited, it needs to be updated to the Content summary field.

What better way to improve efficiency?

Reply content:

There is a large amount of data in the MySQL table, but a summary of the field needs to be read.
For example, this field is primarily used to store articles, and this field of all records for this table is very long.

The efficiency of the Select Title,content from article when querying is much worse than the select title from article.

The previous practice was to read the Content field directly and then use the function to intercept it as a summary of the article.

Now think of a way to save two fields, content fields and content summary fields, but if the content is edited, it needs to be updated to the Content summary field.

What better way to improve efficiency?

I think we should use Redis and other caches to cache the field digest, each time you add or delete the summary of the time, the cache can be synchronized. So put it in the cache and don't check the library. Redis is highly efficient!!!

    1. In fact, you've come up with a way to do it, abstract isolated storage is a good idea.

    2. Introduction of external caches such as redis,memcache, etc.

Comparison of select Title,content and individual select title
1. What kind of table do you have?
2. Need to consider the amount of data transferred, because the data interaction is not only the database work and network card

Select Title,left (content) as description from article

In fact, you already have an answer.

  • 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.