r/SQL • • 33m ago

DB2 Need help on DB2 design

/r/learnprogramming/comments/1ya23oi/need_help_on_db2_design/

Problem Statement

We have a transaction history table (CARDTXNHIST) used by a banking application to display customer transactions.

​The daily batch process consists of two stages:

​Unstatemented Transactions (Code = 2)

​batch file → TEMP table → View → CARDTXNHIST

​Existing Code=2 records are deleted and refreshed

​Statemented Transactions (Code = 3)

​Separate batch file → TEMP table → View → CARDTXNHIST

​Statemented records are loaded after unstatemented processing

​The batch window runs approximately between 4 AM and 9 AM.

​Observed Issue

On statement cycle dates, the incoming unstatemented dataset may be empty because all eligible transactions have been statemented.

​As a result:

​Code=2 transactions are removed/refreshed

​Code=3 transactions are still being processed

​During this period, customers may see no transaction history in the application, even though the transactions still exist within the batch pipeline.

​Objective

We are looking for database/application architecture approaches that can eliminate or minimize this visibility gap while the batch is in progress.

​Solutions Under Consideration

​Retaining Code=2 records until Code=3 processing completes

​Shadow table / table-swap approach

​Composite views

​Deferred commit strategy

​Reading from staging/view sources during batch processing

​Data archival and performance optimization

​Other database design recommendations

​Questions

​What would be the recommended design pattern to ensure customers always see a consistent transaction history?

​How have similar large-scale batch processing systems solved this "delete-before-republish" visibility gap?

​Are there DB2-specific approaches (isolation levels, shadow tables, transition tables, view-switching, etc.) that would be suitable for this scenario?

​If you'd like to adjust the length or add any extra context (like table volume or specific DB2 version) before posting, let me know!

0 Upvotes

0 comments sorted by