Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRCII-0007cf-9z for pgsql-admin@arkaria.postgresql.org; Tue, 30 Mar 2021 11:12:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lRCIH-000339-8a for pgsql-admin@arkaria.postgresql.org; Tue, 30 Mar 2021 11:12:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRCIH-000332-0R for pgsql-admin@lists.postgresql.org; Tue, 30 Mar 2021 11:12:21 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lRCIE-0005nT-Lz for pgsql-admin@lists.postgresql.org; Tue, 30 Mar 2021 11:12:20 +0000 Received: by mail-ej1-x62d.google.com with SMTP id b7so24224170ejv.1 for ; Tue, 30 Mar 2021 04:12:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=LvPkizgVJ1o9uhbQUeyaL+tYGglRhL2SYnOBnvbTA+I=; b=y3x0T/2dkqEmXhyDFZPMxZ6iIaqKAtYZYBHUglVAShiPSipJ+J4kkCbUfKgbER4I2x MbJ4yiXG0ekH3t8WIfRWOlYo71ur/Ne2HbiMtV660wfxKq/ViyIk/MZUzGHG/gtD0WDD I/PxGawHoAjIhzaCGXX8YiZbC95JhWHJukzg1gsxUua6sRPbM7400mfvNs/NItG++9eF 8xHy2A/Oy6b2s96JI1EBzSkMOA09zL0DWBZUkbfdugoLnjfU+0MA5MM3d+kV2SHo8E5k fKPX+UZRPP+PT4nlDlecWZmNMaMq/9uDNfZZwMNOdSGoatNBiIx/JqHFI58rtPslNnB5 Dguw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=LvPkizgVJ1o9uhbQUeyaL+tYGglRhL2SYnOBnvbTA+I=; b=gc2XLCdZ7aICIkOhOqtvvecfd/jbUX34kBSPC12cFgPHHIfjfgFtCOssqH8wuoGta2 eFWUbRcAI0HzxQDe/3po4rgLx4meVBbxOCXPDwUoLKnIdLHXTZCRiaOVS2szqWkEAZXA 4+JOJqZ6R0xJMcO4OGWjt1JpEuVh7sawXv2pTdxhA50S27+4txKNeJ3KJ1sborz735HB OvzJU9uBiux3HW7xXcdTJMX2CbUNKWpg+ml8B9uDJHPdzj/Bl5MjwMF2u1If4hFqvIaF 3n5R9IAnkbO4i3hfwYwm+6VgTVLvCk09kA/jzvwfaqHEdCPo4AYChQtGGEYjaOD8GNRI czeg== X-Gm-Message-State: AOAM530stdIkbQCTT7KQSriWVRCuF1/U7zhh5gsy0OPhfll1u48Ef0AS aec1FbqQH/LEPtVAzcz/MPi5HwWhkvA99g== X-Google-Smtp-Source: ABdhPJyTmTWXWhFI7UDWIVrFpC3KwUndz1OYlzumk7WPdRAvemczOg0SWaQRdf/fKa0df0vHYeR6AA== X-Received: by 2002:a17:906:3643:: with SMTP id r3mr31966089ejb.527.1617102737851; Tue, 30 Mar 2021 04:12:17 -0700 (PDT) Received: from localhost.localdomain (217-149-168-246.nat.highway.telekom.at. [217.149.168.246]) by smtp.gmail.com with ESMTPSA id q26sm9915035eja.45.2021.03.30.04.12.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Mar 2021 04:12:17 -0700 (PDT) Message-ID: <295d4316f690b7666dcd21b745a4163b88a5ee4b.camel@cybertec.at> Subject: Re: ALTER TABLE ADD COLUMN takes forever From: Laurenz Albe To: Devendra Yadav Cc: pgsql-admin@lists.postgresql.org Date: Tue, 30 Mar 2021 13:12:16 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2021-03-29 at 22:48 +0530, Devendra Yadav wrote: > > I am running a query on a table - ALTER TABLE mytable ADD COLUMN deposited DOUBLE PRECISION DEFAULT 0.0; > > > > > > this query just runs forever. > > > > Then either you are using a PostgreSQL version older than v11, or there > > is an open transaction that used the table and blocks you. > > We are using PostgreSQL v12.1 > There are no open transactions as the table is not blocked by any pid. However when i check pg_locks it say granted=false > but nothing blocking it. Bit strange!! As I replied in the other thread you started, you are probably blocked by a prepared transaction. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com