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 1lRCFo-0007VN-Lj for pgsql-admin@arkaria.postgresql.org; Tue, 30 Mar 2021 11:09:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lRCFn-0008CC-GU for pgsql-admin@arkaria.postgresql.org; Tue, 30 Mar 2021 11:09:47 +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 1lRCFn-0008C5-3U for pgsql-admin@lists.postgresql.org; Tue, 30 Mar 2021 11:09:47 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lRCFi-0005mb-CM for pgsql-admin@lists.postgresql.org; Tue, 30 Mar 2021 11:09:46 +0000 Received: by mail-ej1-x62c.google.com with SMTP id u21so24147976ejo.13 for ; Tue, 30 Mar 2021 04:09:41 -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:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=ryPN14vKO3Rlzus/uiTi5GP1CH3YSF5OF1A3s147XNw=; b=daPG+Xd5NcuWpOYL222u74j6aHRdyynnw03Cjx6F7joCMeD7bLpZmY7Rg7wWtvOahj 2hdebtIl7/rrdMqPkuxG93vWK/LeNzicYprz+im3lXbR+rqfV4WCCVbR4kTkwEpJd590 vI9/jumHmj7EqnBT150n9TMmF3G38F5w2l3krZmqKGrhXeDTCXMJifOcamkIeQIBg9F+ JN1ZmHPTyEeaOuJU2QnUYR3UNOM6WkHsrcyAyd60RJgnyXPGZCn9h5RAFdfMEkMY5Rm+ dTXuMzAZ1K1nL5MeqckF/w2+aW/pYBtLhVY4nbasjqn6FBx7D4QiRGhhYNS6d5qNMFW0 UqNw== 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:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=ryPN14vKO3Rlzus/uiTi5GP1CH3YSF5OF1A3s147XNw=; b=QVGCpLKOkkTBUv5qrIaYR1b85B/yxYul7lPC5bDGbtM0vD/C1GB9U5OoIU8x+dVgE7 FBfppBgumuKcJUJ68pzT17zGhV4VhvXaOOj/PMOzAJXit5TttO2IhhSKTYIU2doQfB8N WhhlQRIqLnPLuedTjlhIRGDDWtt/bmXTrk6pvDMrTjhKyLf4j9yuCfRI5ezPg0Hlp+4f Mm9utqBh7ymp56RMw031kixAYhDzN+mIwXSWgowlmZkPG7llAIVXubI1ywPIQlU10MFM 6823DQ3xDstCy/W4sn9k5bXpPBPV+L0VAedwK+WYRB6wvBj7OANquABmYsG4Vs0iJu+k HkaQ== X-Gm-Message-State: AOAM530u7VlCgOjm4bjJLdiWnqqSOwE3jaY5Z/cOGefbxpmnmocGi2KI AKQldXiDXolx9+u4LF7S3gMgfw== X-Google-Smtp-Source: ABdhPJyjR4TzDKpegHmSV+MSzvQm42f551mgpTUuSD99ZskFGjLvMlLhgXQcC6I9LGUL4METsXsRHg== X-Received: by 2002:a17:906:4055:: with SMTP id y21mr32253984ejj.507.1617102580489; Tue, 30 Mar 2021 04:09:40 -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 r24sm10749410edw.11.2021.03.30.04.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Mar 2021 04:09:40 -0700 (PDT) Message-ID: Subject: Re: ALTER TABLE blocked From: Laurenz Albe To: Devendra Yadav , pgsql-admin@lists.postgresql.org Date: Tue, 30 Mar 2021 13:09:36 +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 Tue, 2021-03-30 at 12:36 +0530, Devendra Yadav wrote: > Hope everything is well with you. Thanks, yes. I hope you are fine too. > We are running on PostgreSQL v 12.1 , Redhat 7.8. > We are running a query - ALTER TABLE mytable ADD COLUMN deposited DOUBLE PRECISION; > > This query is blocked by pid 0. It's not a postgres PID and won't allow to terminate from postgres. > What would be the way forward to troubleshoot this? That is probably a stale prepared transaction. Look into "pg_prepared_xacts" for any prepared transactions and use ROLLBACK PREPARED 'name'; to remove stale entries. When using prepared transactions, you must use a transaction manager that does these things for you. Also, you should monitor prepared transactions. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com