List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:January 12 2009 9:09pm
Subject:Re: Why does changing a table property rebuild the table?
View as plain text  
In the last episode (Jan 12), mos said:
> At 12:14 PM 1/12/2009, Dan Nelson wrote:
> >In the last episode (Jan 12), mos said:
> > > I'm using MySQL 5.1 and if I execute:
> > >
> > > alter table mytable delay_key_write=1;
> > >
> > > it takes about an hour to rebuild the table. Why? As far as I
> > > know it is not changing the table structure. So why does it have
> > > to make a copy of the table and reload all the data?
> >
> >Mysql plays it safe and assumes that any table modification requires
> >a full rebuild.  5.1 knows that certain settings don't require a
> >full rebuild, but delay_key_writes isn't one of them (and some that
> >are marked as fast shouldn't be - see
> >http://bugs.mysql.com/bug.php?id=39372 ).
> 
> Why would delay_key_writes require a table rebuild? It's not
> modifying the data. Reloading tens of millions of rows for several
> hours seems to be a waste of time.

It shouldn't require one; at worst it would require flushing all dirty
key blocks.  Historically, all "ALTER TABLE" commands always did a full
table rebuild, and only recently has the ability to do quick ALTER's
appeared.  Maybe they're adding one flag at a time to the quick list,
or something.

-- 
	Dan Nelson
	dnelson@stripped
Thread
Why does changing a table property rebuild the table?mos12 Jan
  • Re: Why does changing a table property rebuild the table?Dan Nelson12 Jan
    • Re: Why does changing a table property rebuild the table?mos12 Jan
      • Re: Why does changing a table property rebuild the table?Dan Nelson12 Jan
        • Re: Why does changing a table property rebuild the table?Baron Schwartz13 Jan
          • Re: Why does changing a table property rebuild the table?mos14 Jan