We have two processes which are operating with delete/insert/update
on the same table, but in different areas.
These areas are clearly separated by a dimension field. Here is a simplified example:
- Process 1:
DELETE FROM facts WHERE Area = 'Actual' AND [...]
- Process 2:
INSERT INTO facts (Area, [...]) SELECT 'Plan' as Area, [...] FROM [...]
Now it happens that we get deadlocks between these two processes. However, they are operating on different records! Is it possible to prevent such deadlocks? e.g. is it possible to make a partial lock, or to give a "hint" to the processes so that they know that they are acting on different areas?