"Valentin Tihomirov" <valentin (AT) abelectron (DOT) com> wrote
Quote:
Yes, thank you for correcting me. It is a question about style of
application programming. I want to know opinion of DB engeneers. Whether
should the application designers make their best or it is does not make
sense to update a record on per field basis? |
The main problem at the logical level of always sending every column is the
risk of lost updates in an extra-transactional concurrency situation. e.g.
If a table has two columns A and B, two users might read the same row and
then interact with the values outside a transaction. If one user makes a
change to column A and saves it and then the other user makes a change to
column B and saves it, the fact that the second person also sends the
original A value means the first person's change gets undone.
At the physical level, one must consider all kinds of factors: latency,
bandwidth, peak vs. average transaction frequencies, the number and type of
indexes etc.
Thus, for instance, if bandwidth is the primary constraining factor, sending
only the changed columns makes sense. If latency is the primary constraining
factor, having fewer larger interactions makes sense. Unfortunately, as
technology changes, the constraining factors change. At one time, memory and
storage were expensive. That's hard to believe at today's prices.
As always, design requires tradeoffs.
Ideally, we will eventually blur the distinction between our application
languages and our data management languages by raising the level of
abstraction of our programming languages to approach that of our data
management languages. Once we do that, I think we will have much greater
flexibility for shifting processing between the client and the server and
for balancing issues such as bandwidth and latency without changing our
application source-code.
Until then, try not to do anything that is obviously wrong and focus your
efforts on the problems you actually measure.
Cheers,
Bob