The project is completed with my own design code and integrates the tests. The problem occurs when you initialize the data. It is very slow to accept data at the beginning of the client. Test environment, the database server is deployed abroad, the site is deployed inside the company, and I have always thought that my program has done enough optimization in database data processing, including indexing and primary keys have been properly used. To sum up, the initial speed problem has not aroused my concern.
However, the key point of the final question is that in the database connection query, frequent queries result in slow initialization of data. At first I took the approach is to use that is to check: the need for data from the database, there are more than a single table query returns a single field. If I have about 3,000 data sets, I loop out each of them, and then query from other data table to get the required fields, so as to increase more than 3,000 times database connection and shutdown operations, when the network speed is not ideal, the speed of the program can not be tolerated.
Stick to one rule: Minimize database connection operations. Similar to the minimum HTTP requests in front-end development optimizations.
Ultimately, the solution was to put the required data across multiple data tables in a single List object, that is, in memory, and it would be much faster to query each piece of data based on LINQ. This seems to be destructive of a principle, I followed the multiple table query is best not inner join3 more than one table, and this time a number of SQL statements are inner Join3 A table above the situation. Although this principle is broken, it is obvious that the inner join can be accepted in a situation where the speed is extremely slow and the functionality cannot be achieved.
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.