Project requirements begin to contact actual springboot development recently, don't change the SQL query learned in school, in order to bring a few tables, wrote a long long SQL statements to query across the table, crazy leftjoin, associated with the 4, 5 a table to show the name this field, and his colleagues learn, he told me that the query efficiency is slow, I say not have paging? He said you so check pressure pressed on the database, data just blew up, and then told me a heterodox, he first table query and extracted to associate with flow field in the input, and then take several other table check respectively, after obtaining several array with partial matching flow into, such as long as the back-end to won't have an accident, look for the first time almost see my head dizzy, completely don't understand the logic that came to be the boss KuangPen, woe betide anyone who maintain this code, the boss also said that the best use SQL query table more, if the associated field with the view, in the flow efficiency too slow, but I think my colleagues said makes sense, multi-table query pressure is in the database can be a bit problem, some requirements is only used in one or two common and worthless when specializes in view, this how to choose? What business scenarios with back-end processing data well what circumstances use SQL statements to deal with?
CodePudding user response:
Look at the situation, and some related dictionary with assembling business better, correlation is not strong field or SQL, easy to maintain SQL design can be used in a certain redundancy mode, when in space, in time, so you need not even a table or reduce even the table
CodePudding user response:
If the data quantity is little, various leftjoin lead to SQL is very long but don't take time, also can accept, but this way with data volume growth will be more and more slow, behind still have to optimize
Long-term consideration, or break up and then run SQL multithreading (parallel) ideal point
CodePudding user response:
Watch what you say, should need to moderate redundancy design table
CodePudding user response:
Whoever has a code review, you this colleague showed the code will be pulled out alone
CodePudding user response:
In space, in time, said there is nothing wrong with the
CodePudding user response:
Personally think that the performance of the database is more precious than the performance of the application, conditions allow SQL to lighter as far as possible, give than job application,