Friday, 22 April 2016

How to reduce Impact on Server and Network traffic.

To reduce impact on server :

1. COMMIT Function : Usually they're automatically handled by database. So avoid using it as much as possible.

2. LOCKTABLE Function : During inserting, modifying, renaming and deleting a data in a table. The SQL Server will automatically locks the table. So, avoid using it.

Example :

Consider a Customer table-

Developer A will check the cost between 10,000 to 50,000. If necessary he 'll modify some value.

If Developer B is also working on same database and same Customer table, modifying the value by Developer B will also affect the changes of Developer A. So, Developer A will lock the table while working or retrieving any value from table.

But, since SQL Server will lock the table automatically when you try to modify the data. Hence, avoid using LOCKTABLE function.



3. Don't examine(or verify) return values of insert, modify, delete function, If it is examined server must be notified.

4. Avoid Roundtrips to the servers.
Round trips - A round trip consists of a request sent to the server for data or an action (whenever a call to insert/modify/delete trigger for an action it takes time and resources which impacts on server.

4. Use CALCSUMS and CALCFIELDS function - Use it whenever you get a chance, to avoid examining records to total values.

5. Use SETAUTOCALCFIELDS function - Whenever you need to obtain value of flowfield for every single row in loop.


To reduce Network Traffic :

1. Apply keys and filters, and use MODIFYALL and DELETEALL functions instead of using modify and delete for each record.

2. To perform calculation on server fields that have single function call, use CALCSUMS and CALCFIELDS (both will take multiple parameters)


No comments:

Post a Comment