Database thinking and speculation

Source: Internet
Author: User
Tags md5 encryption one table

Software is really not a good way to go, specific to the details of the parts so that the head big. The front end is a little clearer. After one o'clock, think of the use of the database is difficult to clarify.

According to reason, the database is a relatively easy to store and read the file format, like the TXT format, plus some encryption processing. Specific to the internal division. The scalability of a database, as well as the module that the database represents, the internal stack processing logic that is represented. I have not seen it, so it is not easy to imagine, the general know.

If you can, set up a database for each user so that each time you log in to the appropriate database to find things, not so all crowded in a table. The advantage of squeezing in a table is that it is convenient to use, just like whatever it is on this shelf, it is more convenient to use and will inevitably affect the speed. If you logically divide the database and the table with the fields within the table, it is a bit of a bother.

Sub-tables, sub-fields, sub-database connections. Each time the connection of the various sites are basically, they see some of the small web site basically use a database, directly a login name, password login to a database, all things in the inside operation. I don't know what the timing of this login is, but since it's a library level, it's naturally a bit more involved than the table level or field level. Library A connection unit, generally and a library to establish a connection, then create a dialog, the "dialogue" mode to access the contents of the database. If the user is divided into the library level, then each user in the use of the database will have to establish a separate connection. The library is the default connection, or there is something else you haven't used.

The site you saw before is written in the same table, and many fields are written on top. is a small site, so it is actually possible to write, more convenient to extract data. At that time depressed for a long time, would like to look at the database classification logic, the results of each application is quickly placed directly into a table.

Correlation query is a kind of general trouble query, after the field has been found through the correlation key to another table and another table, etc., so the traversal is many. If it is short data, that is, the number of fields, field content is relatively small, it is easier to traverse it. This takes into account a number of "efficient building libraries".

Grading is a good way to handle it, such as user name and password. User name in a table, user name, password a table, and then a table to put some of the user's field information. The first ID sequence of three tables is the same. It suddenly occurred to me that Oracle could build a retrieval key and use it for multiple tables, as if it were connected to multiple tables, as if multiple tables were to be written into a table with a uniform ID sequence, and the distinction was probably made by identifying the high-frequency query area. No, that is the auto-growth sequence of the application, should not have the ID sequence shared, there is no function, after all, the ID has been sorted, from one table to another table the most convenient from the ordered ID can be directly obtained. It's strange that the auto-grow field is built on its own.

The surface audit user exists, take the existing sequence ID to directly to the user name, password again match, after matching, take the sequence ID2 to fetch the data. To make sure that the two operations are meaningful, and then no longer repeat the validation operation, the user should be given a permission to go to the data after the second operation. That is, ID2 and permissions exist at the same time to fetch data. Then if you get permission from another user, a random ID2 may get permission from another user.

When it comes to specific problems, it is sometimes difficult to stand on the point of view and analyze the problem. It would be better to stand on the point of view of demand. Security level has always been upward, in the past or in life, security is not absolute, is within a certain range of security. The digital angle and the demand angle are two different extremes, the digital angle unfolds the question to have the big strength, the out not necessarily uses to obtain; the demand angle analysis comes out the same function which the code realizes, after all, the code and the reality "constructs the Wall" The logic is not the same, writes according to the demand will have many logical loopholes to drill.

At the time of the algorithm, it is always felt that there can be an algorithm to pedal. Just like bubble sort or binary order search, it can improve efficiency. Suddenly think of the dichotomy method seems to be used in the database, if it is unordered need to all traverse, if it is ordered directly can be found. If it is orderly disorder can be, for example, a row of user names, each time the user is stored in the user name, the user name is sorted, when to retrieve the user name .... Seems to use less than the dichotomy, the direct use of filtering method is faster than the two points, especially the late data is relatively large, jumping back and forth is also more tired. So I didn't find the use of the two points.

Refers to the pedal ground algorithm, is the algorithm more direct, can make people feel more practical. Another kind, such as MD5 encryption algorithm, random functions, these are relatively floating content, the realization of some artificial judgment logic, those logic itself is not rigorous, so write to also more floating, became a mathematical problem.

Encryption algorithm, is not often seen in life things, some content stored in the database with this word is still a little useful. Encryption algorithm means that one end enters, the other end of the process is not reversible, and less accounting for system operations and so on. The random algorithm is based on the time, the number of milliseconds, or else there is no other change in the computer can be taken. So in the method of implementation itself on the existence of mathematical logic loopholes, so that people use uncomfortable, the bottom is not a thorough feeling.

The purpose of the encryption is to not know the password, the ligatures code of the people do not know what the password is, encrypted generated fields want to translate back to find the encryption process, so each encryption algorithm should be considered a black box. Not cracked, is to crack up too much trouble, the average person is too lazy to crack. Just enough trouble, can hinder others to do it. Too simple, like Sina, the user name, password has been stolen directly can see, is not very good thing. If it was encrypted, it might have been decrypted, but then ...

Think of the previous small site, two times MD5 encryption, in the middle there is a key MD5 (MD5 (password) * key), so with a key, and then the encryption algorithm itself can be. In general, the password has strict requirements, because the encryption process can only use those letters, underscores, numbers bar. The key is saved as user data in the database.

That is to add the gongmen procedures, if the other side can not guess the way the treatment, it will not go in. If you want to go in, try to do something more or you can anticipate it.

Suddenly think of, used to think that the calculation to do things can be separated from the logic, to prevent the exchange between people, like the college entrance examination, to cover the name part of the same, so that each department can be based on the "true ability" evaluation and processing. Later think of this demand is not the superiority of computer work, in life also has this treatment, the computer just to digitize it and not further enhanced, the use of computers or computing is efficient, easy to save, convenient transmission and so on.

Important data is still to have the file record, after all, the preservation of the file has a very mature solution, the computer is only a few years, the hard disk familiarity of how much.

Now the storage device is the disk, rotating storage, outward distribution. The understanding of solid-state drives is still limited, and now SSDs are faster and more expensive.

It's better to check it out.

Underlying storage, encryption algorithm, query method, sub-field sub-table sub-database ...

Database thinking and speculation

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.