Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id DACB365B055 for ; Tue, 16 Mar 2010 14:05:35 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 54709-02 for ; Tue, 16 Mar 2010 17:05:22 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-yw0-f202.google.com (mail-yw0-f202.google.com [209.85.211.202]) by mail.postgresql.org (Postfix) with ESMTP id 408EC797B0F for ; Tue, 16 Mar 2010 13:39:38 -0300 (ADT) Received: by ywh40 with SMTP id 40so47749ywh.19 for ; Tue, 16 Mar 2010 09:39:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=ycdLW6bnFWeuy7H5zyQEjdS/Z7QZytw2VahVmMaFsY0=; b=VHtxHKB+sOW5IyFRXobYINQI6T1PcyhPBM21lvPv4WA+TS9Dp7qIfStQYGCnth4DHn rwMIjE8Q16CajqfT6fAQLbWeRRWwSuPcEqLtlSO75LUGYBFcPSm76UxLvA+uasBqMQbE UCkv/+eOgIWaxmKW+BDQiUhbq6jQfQMmrQg34= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=jitrsor+GZrfYNEBv8PZBfdEdLPOBkB76NEAjhIHS0tDuRboFHI/D4mXvaCWK/KUlQ 5NBBzg99OiV1xmZXyE8ssGsTb1535amHtYM7oOnPIav9E/1FHu9Q0ff4inJAffP4EWKq diUfHZtBNkbZ44kBYwvniUQ7XmEPjdtF8jbog= MIME-Version: 1.0 Received: by 10.150.169.1 with SMTP id r1mr3683470ybe.216.1268757577276; Tue, 16 Mar 2010 09:39:37 -0700 (PDT) In-Reply-To: <201003161045.58639.thomas.kenner@gmail.com> References: <201003161045.58639.thomas.kenner@gmail.com> Date: Tue, 16 Mar 2010 10:39:37 -0600 Message-ID: Subject: Re: Rename Index - Deadlock From: Scott Marlowe To: Thomas Kenner Cc: pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/107 X-Sequence-Number: 33814 On Tue, Mar 16, 2010 at 3:45 AM, Thomas Kenner wrote: > Hi, > > Each day I'm recreating the index my_index of the table my_table. Therefore I > create a new index my_index_new, drop the old index my_index, and rename the > new index: > ALTER INDEX my_index_new RENAME TO my_index; > > If an insert or select statement is run at the same time as the "ALTER INDEX > ... RENAME TO" statement, it will end up in a deadlock. A deadlock or just a lock? What version of pg? What exact error messages do you get?