Update rows vs. Delete+Insert

From: Stefano UNTERNAEHRER <unter_at_mecati.mecasoft.ch>
Date: 1995/07/04
Message-ID: <DB6MvI.Ftr_at_mecati.mecasoft.ch>#1/1


Suppose to have this tables:

Table A: KeyA Description

  • ----------- 1000 First 1001 Second 1002 Last

Table B: KeyB Description

  • ----------- 110 One 120 Two 130 Tree 140 Four

Table C: KeyA KeyB

  • ---- 1000 110 1000 130 1002 120 1002 130 1002 140

Table C describes the relations between A and B. Very simple. Suppose I have to change the relations for one Table A's member, ex: 'Last' has now relation with 'One', 'Two', 'Tree', so I have to replace in table C the rows:

           1002  120
           1002  130
           1002  140

with the new ones:

           1002  110
           1002  120
           1002  130

As you can see, two of them ar identical. At the moment to change this relation I simply remove the old ones (all the tree rows) and insert the new ones. All seems to work fine, but what about TABLE FRAGMENTATION ??? It would be possible to verify with one are already correct and just drop the incorrect (1002-140) and add the new one (1002-110), but this require TIME !!

What is your opinion ?
Thank you for any suggestion,
Stefano


______________________|    Stefano Unternaehrer    |__________________________
\  Mecasoft SA        |         Oracle DBA         | fax:    +41 93 335 507  /
 \ 6600 Muralto       |     and  PL/SQL, Pro*C     | voice:  +41 93 337 444 /
  \                   |     C, XWindow & Motif     |                       /
  /                   |     Software Developer     | email:                \
 / Switzerland Europe |____________________________|  dba,unter_at_mecasoft.ch \
/________________________)                      (____________________________\
Received on Tue Jul 04 1995 - 00:00:00 CEST

Original text of this message