Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eShtA-00038Y-Bv for pgsql-general@arkaria.postgresql.org; Sat, 23 Dec 2017 11:22:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSht9-0001t6-IA for pgsql-general@arkaria.postgresql.org; Sat, 23 Dec 2017 11:22:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eSht9-0001sw-68 for pgsql-general@lists.postgresql.org; Sat, 23 Dec 2017 11:22:47 +0000 Received: from mail-qt0-x234.google.com ([2607:f8b0:400d:c0d::234]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eSht1-0007oy-3j for pgsql-general@postgresql.org; Sat, 23 Dec 2017 11:22:46 +0000 Received: by mail-qt0-x234.google.com with SMTP id u42so38981513qte.7 for ; Sat, 23 Dec 2017 03:22:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=pudMH2q0Akv49k+oyK9O8STDm1BkGxLOe6e3JFJIkHU=; b=X9hOeQ4/cRxiUyVdwGCv/uWDFMo8EuydH3UD4Z1JFkiCiZst2WpwJntxjTbiyhveh3 HtGplWu5/i6kP5eGrvjOsYfzYVxbl3yBKJa/9JDmCKtIrHyr5q0qRwsvvzLIQ7pAKnjI y63kh+w3LwnAR7eYAbEuvNtZYu7+CnqyHW8/Im1V7agcKgXCrrEXAot4lE267JbWwHmT fIYez7rVACuuiFljdk59RH057SjX8KmsfNAcZoz5dE36UcrwtUD8xAgS9LaFVDFtbIIA /hUmi8a4D1BsY1u6ELS5LSW5JyqfxHspQR9gemWgDCjlD3G8dWnmcDU4byi/AID/T397 TTEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pudMH2q0Akv49k+oyK9O8STDm1BkGxLOe6e3JFJIkHU=; b=S/ZzXGkUSjNpzAY9fYHk9zXS1z+NZGqOFtPnWHO45RxtXQvMvJYVSUTboEpy7Bzfyv CfYELYup5P7SLev7kGmFe6tDsb4R7Q+xNjEiNtWxlNqjFj6fruYOdfnE397oRYqMY3H+ psyVEyZTUE1RegmcA+NGFD+4MkF+uB1j3wCsAbwMvau5B1+9sr91fD4iybV2t9WtEy12 Vre10dLs3a7dL52MiPDmag6bjDHuPdwX24ey9n4cpFBHzOD8SyiComLpROJS6fQTBbbs T96Hisq5g09z0jZ7msZs6dpRH/8zGA3SHoI7+nyRXv6910kwt/TGm0hJHKeLHQ/r1kRg 1Adg== X-Gm-Message-State: AKGB3mIEkxU0LmSBhs9yTaArqDGLpRNxQb8/QVaVnb6R4iEdgRJz8UdA 7dOGdMB3iK7h9yuMDArNcNr2qLot5rI71udJGX3z98Z/uY9fRVWyOVWLPrvUQajEcwawrD18h/R V4KMu5b+qlR1jEN2aLUbFNCSJAY+/+DuI2maLzyweWZ67gI+u6VyjFGxiB0HO3Br9DUTDfXI7B/ kl0rnPBD+kPvhSkA== X-Google-Smtp-Source: ACJfBottBuY+fGy+y79C93nkT4lGPIMXMGdByvQxHfzbdLu+FNU2e9ypgLfN5LrBYz1mlabLkY2Sdg== X-Received: by 10.200.50.196 with SMTP id a4mr23526651qtb.214.1514028156653; Sat, 23 Dec 2017 03:22:36 -0800 (PST) Received: from alderaan.marques ([200.82.53.14]) by smtp.googlemail.com with ESMTPSA id q15sm5516039qkj.31.2017.12.23.03.22.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Dec 2017 03:22:35 -0800 (PST) Subject: Re: Deadlock between concurrent index builds on different tables To: Alban Hertroys , Jeremy Finzel Cc: Postgres General References: From: Martin Marques Message-ID: <1df2ab90-664f-1d91-8c58-a465a971d32e@2ndquadrant.com> Date: Sat, 23 Dec 2017 08:22:33 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Language: es-AR Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk El 23/12/17 a las 08:08, Alban Hertroys escribió: > >> On 22 Dec 2017, at 22:53, Jeremy Finzel wrote: >> >> 2017-12-22 15:48:07.669 CST,"CREATE INDEX",2017-12-22 15:48:02 CST,8/32,0,ERROR,40P01,"deadlock detected","Process 4470 waits for ShareLock on virtual transaction 4/262; blocked by process 4466. >> Process 4466 waits for ShareLock on virtual transaction 8/32; blocked by process 4470. >> Process 4470: CREATE INDEX CONCURRENTLY index_foo_on_created_at ON foo USING btree (created_at); >> Process 4466: CREATE INDEX CONCURRENTLY index_bar_on_id ON bar USING btree (id);","See server log for query details.",,,,"CREATE INDEX CONCURRENTLY index_foo_on_created_at ON foo USING btree (created_at);",,,"" > > If I read these logs correctly, you are creating the exact same index on foo (created_at) in both processes, which is just what you were trying to prevent doing. They are two distinct indexes. One on foo(create_at) and the other on bar(id) -- Martín Marqués http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services