Skip to main content
Known Participant
September 5, 2023
Question

Read and write to table at same time

  • September 5, 2023
  • 1 reply
  • 244 views

Hi,

Using coldfusion 10. Have one table insertion from Table A to Table B in a loop

With a flag=0 in TABLE B.

A scheduler is running at 5 minute interval reading data in a batch of 2000  from Table B and processing it.

After process, update Flag =1.

 

When there was around 20,000 data in Table A, it inserted only around 16,000 records and stopped. 

Is it because of simultaneously read and write operations?

What is the ideal way to avoid partial insertion?

 

 

 

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
September 10, 2023

First of all, what is the brand and version number of your database software?

BKBK
Community Expert
Community Expert
September 10, 2023

In any case, it would perhaps be better to make the two processes mutually exclusive. For example, by using a named lock.

 

Some pseudocode to illustrate:

lock name="processABC123Lock" {
/***
Code that inserts from table A to table B.
***/
}

// Elsewhere

lock name="processABC123Lock" {
/***
Code that processes rows in table B.
***/
}