Optimize ADO's execution efficiency

zhaozj2021-02-16  61

Optimize ADO's execution efficiency

Below is the rules that the programmer should know when using ADO. As long as the programmer understands and applies properly in the application system, it is not difficult to make ADO and AdoExpress's good execution efficiency:

1) Try to find the true native ADO and OLE DB driver. Try not to use the ADO for ODBC driver because this architecture uses abnormal execution status when some databases is more slower than native ADO and OLE DB drivers.

2) The quality of the ADO driver has greatly affected the implementation efficiency of the application system, so you should find a good ADO driver for your database.

3) Try to use the client's CURSOR LOCATION and only access the application that the application is truly required to the client, use a small amount, and multiple times to access data. Using a small amount, access data multiple times is a good way for the primary architecture or distributed multi-layer application system. Especially for Internet / Intranet and e-commerce applications, using this approach ensures that the application can still be reasonably executed in many users in the case of simultaneous use of many users.

4) Adjust the Cachesize property value. This is an absolutely impolored setting, and its importance is second only to Cursor Location. Although we can find that the setting Cachesize is approaching 1000 to get the best efficiency / space ratio, it must be considered when the application system is simultaneously accessed by many users, and the amount of data passed in a moment network. How big is it. Therefore, you may have to appropriately reduce the value between 100 ~ 1000 based on your application system.

5) Many discuss how to optimize ADO will recommend the stored procedure because these files are assumed to use MS SQL Server. But regardless of what database used, if possible, then the use of stored procedures can definitely increase the execution rate of ADO applications for the work that needs to handle large amounts of data. Because in this case, the stored procedure allows these large amounts of data to be transferred to the client, but processes data directly in the database, which avoids the serious load of networks. Even if you don't want to use a stored procedure, you might use different databases, for some work that often execute, at least you should use the Prepared ADO / AdoExpress component, which can also increase the execution efficiency of the application.

6) For work that does not return the results of the result, such as UPDATE, DELETE, etc. can be used to modify a large amount of data, and can consider the asynchronous execution mode of the stored procedure and ADO. This greatly increases the performance efficiency of the ADO application and reduces the reaction time of the ADO application.

7) ADO's RecordSet object, or ADOEXPRESS Tadodataset, TadoQuery, and Tadotable components can use SELECT's SQL command access data, and let the user modifies the data to update the data source. However, if you are developing ADO applications perform a lot of data modifications, you should use several different tadodataset, tadoQuery, and tadotable components. One of them is used to select the data required by the user, and use other Tadodataset, TadoQuery, and Tadotable components to perform Update and Delete, etc., which can increase the performance efficiency of the ADO application.

8) This item and the seventh item are related to the TDataSetProvider component to TRUE when you use ADO to develop distributed multi-layer applications, try to set the resolve to dataset for TDataSetProvider components. Let ADO themselves handle data modification without using MIDAS's SQL Resolver because ADO can better handle data modifications. However, please note that because AdoExpress currently has a bug, do not use Tadodataset, TadoQuery, and Tadotable components in the distributed multi-layer application system to perform the SQL commands such as Update and Delete. Use the Tadodataset, TadoQuery, and Tadotable components that perform the Select SQL command to perform the work of modifying the data. 9) Try to use Optimistic and BatchOptimistic in two types of LockType because they don't reduce the resource locking resources, or increase the performance efficiency of the ADO application.

10) ADO's Batch Update mode and BDE / IDAPI CacheUpdate are very similar, whether it is used in the primary slab or Internet / Intranet and e-commerce applications. Therefore, the programmer should try to use this mode as much as possible to develop ADO applications.

11) Tadodataset, TadoQuery and Tadotable components MARSHALOPTIONS controls how access to OLE DB Provider or data sources is updated back to OLE DB Provider or data sources. We absolutely do not want to pass any more data in distributed multi-layer applications and Internet / Intranet and e-commerce applications to avoid waste of network resources. So appropriately set the MarshalOptions attribute value for MomarshalModifiedOnly, which can also increase the efficiency of the application system.

12) For the ADO application related to the graphical user interface, for example, if you need to display a lot of data in the TDBGRID component, don't forget the skills we have already known, temporarily turn off between data perceived components and ADO access components. Relationship, wait for the work of data access to start the connection, then greatly increase the efficiency of the graphical user interface respond to the user. That is to say, don't forget to call DISABLE CONTROLS and Enable Controls when they should combine large amounts of data access and graphical user interfaces.

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

New Post(0)