views:

15

answers:

0

In addition to inserting a new row into a table for each item of work being processed, an additional update is done to a separate row in a different table that contains some kind of summary data (e.g. totals) relating to a portion of the rows being inserted into the first table. This single row however can therefore become a bottleneck if multiple threads are processing an item of work that will update the same row in the table containing the summary data. What could be done to resolve this particular bottleneck? One thing I was thinking of was having the 'summary' table contain a number of rows instead of a single throw, and a particular thread updating that summary table would update a specific row relating to the summary data (e.g. based on the worker thread id/number) - the set of rows would then be aggregated when having to get the appropriate totals (which doesn't happen very often). As a simple example, take 2 tables

A (id: identity, value : integer)

B (aggregate1 : integer, aggregate2: integer, aggregate3: integer, aggregate4: integer)

So, I can insert multiple rows into A, but they could all update the same row in table B (although possible different columns in the same row). This particular row can therefore become a bottleneck.

What are possible ways to remove this row bottleneck?