Horizontal table and vertical table horizontal and vertical rulers vertical horizontal ruler horizontal and vertical view

Source: Internet
Author: User
Tags php write
Recently encountered a problem, if the amount of data is larger how to divide the table?

Information table for example:
I built 100 such tables beforehand, message_00,message_01,message_02..........message_98,message_99. Then according to the user's ID to determine the user's chat information into which table, You can use a hash of the way to obtain, you can use to find the way to obtain, a lot of methods, each person to think of it. Here's a hash method to get the table name:
View copy print?
function get_hash_table ($table, $userid) {
$str = CRC32 ($userid);
if ($str <0) {
$hash = ' 0 '. substr (ABS ($STR), 0, 1);
}else{
$hash = substr ($str, 0, 2);
}
return $table. ' _ '. $hash;
}
echo get_hash_table (' message ', ' user18991 '); The result is message_10

This is the way to get the data table.

The original show was written dead.
You're going to get the table name from the function.

Like the news, the CM s half is divided by category, which is called vertical slicing
The kind of user called horizontal segmentation

For example: List This table has 50W data, you PHP write a judgment, each write this table to judge, is not reached 50W, if reached, write List_1 table, write an automatic add table


Then, according to the criteria, which table is queried and then the operation


The above describes the horizontal and vertical sub-table, including vertical, horizontal aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

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