PHP storage methods and efficiency

Source: Internet
Author: User
PHP storage methods and efficiency problems such as: & nbsp; user table: stores slow update data, such as user name, password, region, and mobile phone mailbox & nbsp; one-to-one relationship & nbsp; information table: points, levels, and other information for storing data & nbsp; updating PHP storage methods and efficiency
For example: User table: stores slow update data, such as user name, password, region, and mobile phone mailbox.

Information Table: one-to-one relationship between data points, levels, and other updated data blocks.

Hobby table: One user id corresponds to one or more hobby type IDs

Favorite table: One user id corresponds to one or more document IDs


I want to convert the one-to-one relationship of a favorite table into a one-to-one relationship.

For example, a table contains two fields: user id and text, which are stored in array mode.

Hobby type id or Article id

Would you like to ask, how can I use this method? Please answer your questions as needed


------ Solution --------------------
The original solution can be easily implemented!

Although If there is no kinetic energy associated with "hobbies" and "favorites"The new solution is feasible.
But it is not desirable.
Arrays cannot be directly put into tables, so you need to perform serialization, deserialization, or json codec.
The array contains only some ids. after obtaining the array, you need to query again what these IDs represent.

Besides, the original solution is two-way User-> hobbies, hobbies-> users can query
The new solution becomes one-way.

Furthermore, serialization or json doubles the data volume. From the storage point of view, it is not cost-effective.

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.