Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Database


    

Blue Forest http://www.lslnet.com at 3:18 p.m. on August 26, 2006


[About] the design of a reservoir escalation against MYSQL4.0 version of the model to design a coding table

I now use the MYSQL4.0 database (for a variety of other reasons, the database upgrade will not), this version is not the characteristics of view, stored procedure, trigger and other enterprise-level applications do not support query.
Table I designed a scalable coding, coding field (CODE) produced by the system, the three-level, this is a basic table coding table.

Now there are two of only one design options :
1, which is the main key ID (self-growth field), and its affiliated businesses to use the ID forms.
The program features :
Sis a.ID destiny key to the code may change; That the coding table coding Mobile (Mobile level, and a different class mobile) or deleted, it is not necessary to amend all other relevant association;
B sis. Inquiries : Statistics do business because of the coding table stored in the ID value is the value in doing classification matrix, it needs to judge the corresponding category ID code, under the code made its counterparts in the coding detailed business value of the summary table ID;

2, the table is the main key CODE field, and its affiliated businesses to use CODE table.
The program features :
A sis. Key coding destiny, we could consider adding a field, the classification system used to control the serial numbers that once produced the record, if only in the cooking class, hi-tech action, there would be no need to amend the code only need to adjust the serial number. But if the movement on different levels, such as demotion or promotion of this record, it must revise the code value, the corresponding need to amend the operating table all the stored value of the code should be updated.
B. Statistics do grade inquiries can be directly group by SUBSTRING (CODE, that :) directly from the classification matrix;

Now like to ask this : the general classification coding, is what we usually deal with, because the two types of programs have their merits, or there are other better alternatives? Em13 : :


For a program, I consider there are two ways to handle : : oops :
A statistical classification doing, Mr. into a temporary table, this table will first be deposited in the major categories and coding records, and then reverse, taking detailed coding table in the total number of business and then directly to all major categories, namely the sum of the sum of final results generated data;
Business conditions in the table given in the corresponding total number of inquiries can be considered the first business conditions table meet record first inquiries into temporary tables, and all inquiries only temporary operating table (table of large amounts of data more efficient business);
B, and build a system to safeguard the physical form, coding table stored in each grade ID, ID code and its corresponding delay, delay ID ', the' separation, corresponding to the records stored in the corresponding string field;
Summary of classification is done, and only collected will be used IN the sum of the corresponding category coding;

:!:
But do not use the large volume of data, are not very familiar with the MYSQL Based unclear, if the dynamic creation of temporary table to deal with the only business group table by SUBSTRING (CODE, that :) efficiency in the way in the end be able to slow?

Experienced heroes hope to guide the instructions! Em10 : :



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com