Some experiences for optimizing data inquiry

xiaoxiao2021-03-06  15

In the web background programming, the most useful SQL statement is probably the SELECT statement. Now how to optimize the data inquiry talk about me. 1, use the TOP key as possible. Usually we will display several up-to-date classification messages in the home page (such as the latest news, published information, etc.), these records often have a fixed value, how to display only 5 items recording. Then use the TOP keyword in the SELECT statement, it can increase the speed of its query. The syntax is as follows: Select Top Integer * from [TableName]. Among them, the red coarse portion is the value to display, such as the precedent, we have to display the top 5 records, and its value is 5.

2, use wildcards as possible * If we only display a few specified fields in the page, it is recommended to use wildcards as possible.

3. Close the object in time, recycling resources, strictly talking about optimizing data queries. However, we must know that the server's operational speed is closely related to the speed of the data query. You must first create a Connection and Recordset objects first before querying the data. When we run a query code, if you no longer need these objects, use the Close property to close and use the SET object name = Nothing to destroy them so that the server is always in an efficient state.

(to be continued....)

转载请注明原文地址:https://www.9cbs.com/read-46705.html

New Post(0)