Microsoft KB Archive/46438
Article ID: 46438
Article Last Modified on 3/2/2005
- Microsoft SQL Server 4.21a Standard Edition
- Microsoft SQL Server 6.0 Standard Edition
- Microsoft SQL Server 6.5 Standard Edition
- Microsoft SQL Server 7.0 Standard Edition
This article was previously published under Q46438
A data-acquisition system is being designed that reads data from the COM port and uses it to update tables in SQL Server. The response time for the update is adequate to keep up with the COM port when no other users are accessing SQL Server. However, when other users are reading the data, response time can increase sufficiently to cause lost COM port data.
A programmer should not expect to be able to keep up with a COM port while communicating with SQL Server over the network.
A program must be capable of buffering the COM port data so that it does not overrun if other users happen to be using the same data. This type of functionality should be implemented with a thread that is running at a higher priority than the one communicating with SQL Server.
In SQL Server, pages cannot be updated while other users are reading those pages. This cannot be deactivated because it would violate the rules of consistency established by J.N. Gray in his paper titled "Granularity of Locks and Degrees of Consistency in a Shared Data Base."
The delay time due to locking can be minimized by receiving all results generated from select statements with the dbnextrow() function as quickly as possible. That which has been retrieved from the database and not actually sent to the client application remains locked until the client is ready for it. Perhaps an extract to a temporary table would make sense in this case. Also, minimize the use of HOLDLOCK and construct queries to use existing indexes. Complex queries and updates should be made into stored procedures to minimize the time spent in analyzing and optimizing the statement.
Additional query words: Optimization tuning Windows NT dblib
Keywords: kbprogramming KB46438