Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 1646A9FB2ED for ; Thu, 18 Jan 2007 12:42:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 20845-01 for ; Thu, 18 Jan 2007 12:42:24 -0400 (AST) X-Greylist: delayed 06:18:11.052409 by SQLgrey-1.7.4 Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) by postgresql.org (Postfix) with ESMTP id A202D9FB2F6 for ; Thu, 18 Jan 2007 12:42:24 -0400 (AST) Received: from [127.0.0.1] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) by olive.qinip.net (Postfix) with ESMTP id 8669918208; Thu, 18 Jan 2007 17:42:20 +0100 (MET) Message-ID: <45AFA36E.2040603@tweakers.net> Date: Thu, 18 Jan 2007 17:42:22 +0100 From: Arjen van der Meijden User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Scott Marlowe CC: Adam Rich , 'Bricklen Anderson' , pgsql-performance@postgresql.org Subject: Re: Configuration Advice References: <090501c73a90$7f154330$6400a8c0@dualcore> <45AF4ACA.5060805@tweakers.net> <1169137253.9586.79.camel@state.g2switchworks.com> In-Reply-To: <1169137253.9586.79.camel@state.g2switchworks.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 0704-0, 18-01-2007), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/312 X-Sequence-Number: 22913 On 18-1-2007 17:20 Scott Marlowe wrote: >> Besides that, mysql rewrites the entire table for most table-altering >> statements you do (including indexes). > > Note that this applies to the myisam table type. innodb works quite > differently. It is more like pgsql in behaviour, and is an mvcc storage Afaik this is not engine specific and also applies to InnoDB. Here is what the MySQL-manual sais about it: "In most cases, ALTER TABLE works by making a temporary copy of the original table. The alteration is performed on the copy, and then the original table is deleted and the new one is renamed. While ALTER TABLE is executing, the original table is readable by other clients. Updates and writes to the table are stalled until the new table is ready, and then are automatically redirected to the new table without any failed updates." http://dev.mysql.com/doc/refman/5.0/en/alter-table.html If it were myisam-only they sure would've mentioned that. Besides this is the behaviour we've seen on our site as well. Since 'create index' is also an alter table statement for mysql, this also applies for adding indexes. Best regards, Arjen