Is it a one-time operation to manipulate multiple data tables when a post (or article) is posted on the website?

Source: Internet
Author: User
Web site in the post such functions, often need to operate a number of data tables, such as posting a post, you need to insert post post table, and then insert the post tag Post_tag relationship table, insert Post_user Post watchlist, update the tag table posts number of posts, Update the number of posts in the user table, as well as the number of points. Are these multiple data table operations completed at once, or are there other ways to use them? It's longer when you feel like you're done at once. When you post a reply or comment, you also have a message informing you that you need to update your Post's views when you display the post. Do not know what the role of BEANSTALKD, I see the PHP Phalcon framework official to do an example of the forum used this, do not know whether it is useful to solve these problems?

Reply content:

Web site in the post such functions, often need to operate a number of data tables, such as posting a post, you need to insert post post table, and then insert the post tag Post_tag relationship table, insert Post_user Post watchlist, update the tag table posts number of posts, Update the number of posts in the user table, as well as the number of points. Are these multiple data table operations completed at once, or are there other ways to use them? It's longer when you feel like you're done at once. When you post a reply or comment, you also have a message informing you that you need to update your Post's views when you display the post. Do not know what the role of BEANSTALKD, I see the PHP Phalcon framework official to do an example of the forum used this, do not know whether it is useful to solve these problems?

The performance of the site is in the database, but for many sites, there is not much data written at the same time.

Depending on your situation, you can do the following optimizations:
1. Data correlation optimization
The correlation between post and tag can be stored in both IDs,
Post_tags,101xxx,103xxx
2. Asynchronous processing of points and message notifications
3. Use cache processing to read and write data frequently
The number of views can be written to the cache first, then according to the actual situation, such as 50 views per page, write a database.

Generally are based on the transaction integrity of the operation to consider, if the integrity of the background is a one-time completion, if not, then you can operate a variety of ways to complete, such as the building said a variety of ways!

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