The importance of architecture + + technology selection table design

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/oyc619491800/article/details/96049113

Work also has more than three years, although the architecture is very general, but there are some of his views. The company's project-based springboot framework was built, in fact, this election can still, after all, spring can quickly build applications, rapid integration of third-party framework, but if done after micro-services, whether springcloud or dubbo can be well integrated recently, the price change is not so big. The persistence framework chose spring data jpa, later also tried with predecessors talked about this architecture, they said at that time in order to quickly develop and choose jpa, for this framework I really do not know, not a lot to say, only We know for certain queries do not need to write sql. At that time a colleague told me privately jpa does not support row crop, meaning that only support select *, which I have not yet confirmed, I will have time to confirm. If this statement is true, I think that technology selection for this project is really great, but I feel like jpa Such a framework should be no problem or there are other ways to solve this problem, here I will keep my Views.
I want to say is really unreasonable design of the table, the table is generated by jpa framework, jpa might really be able to save a lot of things, I found that quite a few strong correlation table has two or more foreign keys of things, very often actually do not need to check the data associated with the table, do not need to check many columns, I will illustrate the following:

I need to do is push a message, which kind of scene is pushed to the needs of all users, then it comes to check user table full table, I looked a bit less than 100,000 data, the user table associated with the two tables, the data in table I do not check, I do not care, I tune the interface directly through the postman to break the line and then look-up table, at least thirty-four minutes did not return, tried several times like this, I can not try to go , each time in order to stop the service to end. Directly on the back of my sql statement navicat by a full table scan, less than 100,000 returns data 1.8S, 0.6S and then only need to check the field, obviously row cropping is more effective. User table field 61, including the associated foreign key fields actually used is less than 8, including an association table actually less than, so that the drawbacks associated with the strong manifested. Although I am not a big God database, although seemingly set up foreign key can save, but involves a lot of CRUD scene when the pit will be a lot, which I quite understand, in terms of personal experience, generally do not set the foreign key. This problem is actually my feedback several times, but to no avail, and I know, because the project ran so long, what architecture layer again and change is hard, so I'm worried that the amount of time the user will happen. On a company, then in addition to doing jvm tuning, optimized code level do we do a lot, to be honest, to optimize the effect of row crop is good, especially in the case of particularly large amount of data, and to reduce memory IO this aspect results are good.

In summary, it is necessary to do a project in the early stages of planning, the cost of post-readjustment is great, a good architect or building project should have a more long-term vision, we should take into account the current era of big data optimization and expansion of late, can not be deprived of the opportunity to become in order to save a good architecture. Of course, this is only my personal opinion, after all, I am limited, perhaps to a real hands Daniel, these are not things. . .

Guess you like

Origin blog.csdn.net/oyc619491800/article/details/96049113