I have a question about creating a duplicate copy of invoiceline table. T
Objective: Every time an invoice gets updated (eg order quantity changed, new order item added etc.) a back up table that mirrors the invoiceline table is updated (the invoice has children invoiceline records) Assuming that there are roughly 3000 invoice lines at any given moment, which one is in theory faster?
Option A: Delete all records in back-up table. Copy every single line in invoiceline table into back-up table. Advantage is that the code is simple.
Option B: For all invoiceline records that were changed, loop through them and update the corresponding records in that back-up table. If a new invoice line is created, create a new copy record in the back-up table. Basically, here I am looping through invoiceline records, going to the back-up table layout, performing a find, updating if found and creating new records if none is found. The code is a little more involved, but not by that much.
Is it possible that both are fast enough, that the eyes won't notice?