At 12:13 AM 12/6/2009, Oscar wrote:
hi all,
Someone told me that UPDATE equals DELETE old row + INSERT new row.
Anybody clarify it?
Are you talking about InnoDb or MyISAM tables.
I'm only familiar with MyISAM tables. Perhaps he was referring to an Update
that added more text to a variable length record in which case the row
could be moved to another location in the table to allocate more space for
the record. This leaves a hole in the table that gets removed when the
table is optimized. You can test this for yourself by writing a small
program that updates the table 100,000 times to see how much the table
grows in size. Normally updating is not an issue you need to worry about.
Of course if your table is a fixed spaced MyISAM table (no variable length
Char columns or Text columns) then updating rows won't have an effect on
the table size. I'm not sure how InnoDb handles it.
BTW, an Insert on Duplicate key translates into an Update.
See http://dev.mysql.com/doc/refman/5.1/en/insert.html
Mike
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org