List:General Discussion« Previous MessageNext Message »
From:Pete Harlan Date:October 28 2002 8:02pm
Subject:Re: InnoDB and auto_increment fields
View as plain text  
> stored?  Why isn't this done automatically as it is for [ISAM] tables?

As for the "why", I'm not a MySQL developer, but I believe the reason
goes something like this: When ISAM tables were implemented, they did
it the "wrong" way.  When other table types came along, they fixed
this "bug" and do it the "right" way.

You seem to disagree about which is better, but I believe the above is
the explanation for the switch in behavior.

As for why the MyISAM/InnoDB way is "right", I believe it has to do
with the idea that autoincrement values are very commonly used in
situations where you want not just a key that's unique in the table,
but one that will never be used again.  Specifically, in ISAM tables,
when you delete the highest-keyed record, that key will be given out
again with the next insert.  Depending on how your application is
written, that could lead to unpleasant race conditions that would be
easily avoided by simply not reusing key values at all.


sql, db
ConnectionArthur25 Oct
  • Re: ConnectionJocelyn Fournier25 Oct
  • phpmyadminMitchell Wright25 Oct
    • RE: phpmyadminEd Carp25 Oct
      • Re: phpmyadmin (OT)Thomas Seifert25 Oct
        • Re: phpmyadmin (OT)Mitchell Wright25 Oct
      • RE: phpmyadminJohn Chang25 Oct
        • RE: phpmyadminJeroen Geusebroek26 Oct
        • RE: phpmyadminEd Carp26 Oct
    • Re: phpmyadmin (OT)Mark Stringham25 Oct
    • InnoDB and auto_increment fieldsChris Boget25 Oct
      • Re: InnoDB and auto_increment fieldsDyego Souza do Carmo25 Oct
      • Re: InnoDB and auto_increment fieldsPaul DuBois26 Oct
    • Re: InnoDB and auto_increment fieldsChris Boget25 Oct
      • Re: InnoDB and auto_increment fieldsPete Harlan28 Oct
    • Re: InnoDB and auto_increment fieldsChris Boget28 Oct
Re: phpmyadminJan Steinman27 Oct