Subject | How to 'lock' a table? |
---|---|
Author | Fabiano Bonin |
Post date | 2006-11-28T18:05:38Z |
Hi,
I have an application that process thousands of material transactions per day.
Today, i use some triggers in the transactions table to keep summary
tables updated, but these triggers are slowing down my application.
These summary tables are not used often, so there is no need to
process them immediately, so i'm planning to use another approach:
To create a stored procedure to access these summary tables, and when
the procedure is called, it will process all pending transactions that
was not processed yet, updating the summary tables and returning the
result i need.
My question is how can i guarantee that when two or more clients call
the procedure at the same time, just the first one can update the
summary tables, while the other clients waits the end of the process?
Regards,
Fabiano.
I have an application that process thousands of material transactions per day.
Today, i use some triggers in the transactions table to keep summary
tables updated, but these triggers are slowing down my application.
These summary tables are not used often, so there is no need to
process them immediately, so i'm planning to use another approach:
To create a stored procedure to access these summary tables, and when
the procedure is called, it will process all pending transactions that
was not processed yet, updating the summary tables and returning the
result i need.
My question is how can i guarantee that when two or more clients call
the procedure at the same time, just the first one can update the
summary tables, while the other clients waits the end of the process?
Regards,
Fabiano.