Safe Updates of a bazillion rows
Posted in 1992
Naomi Walker writes: >If I want to update one column (all rows) in a table that has, say, >a million rows, with two indices, and I dont want to blow out my >lock table, or log files, is there a safe way, short of turning >off logging and doing an exclusive lock and begin/commit work? It seems to me that this depends on the situation. If you are simply setting this column to the same value in every row in the table, then maybe that value might better be stored separately in a different table rather than storing it redundantly a million times. If you are setting it by manipulating other columns in the table (eg: summing two columns) then you are, again, storing derivable redundant data that might better be derived at access time (maybe using a view to simplify processing at that end). I guess the more likely case is that this update is the result of more complicated processing in which you are accessing several tables. In this case, I would think that the process is fairly long running and you would want regular commit's so that if the process fails towards the end, less processing needs to be redone. Warren J. Saccente Bellcore