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 1jZU8o-0001Fd-KC for pgsql-general@arkaria.postgresql.org; Fri, 15 May 2020 06:48:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jZU8l-0004gz-Uj for pgsql-general@arkaria.postgresql.org; Fri, 15 May 2020 06:48:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZU8l-0004gq-JC for pgsql-general@lists.postgresql.org; Fri, 15 May 2020 06:48:15 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jZU8i-0000u9-CI for pgsql-general@lists.postgresql.org; Fri, 15 May 2020 06:48:14 +0000 Received: by mail-wr1-x441.google.com with SMTP id l17so2175381wrr.4 for ; Thu, 14 May 2020 23:48:11 -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=Pczm5pV4ce46NnVKn/lhZTtihLbgQ4E1txXLjuqPc0E=; b=o5rJVEo9jqI2dkvdcCXQHB4WVqOeDkQ4+Ua4/QfhjnnEJe1vkywo2fFihCI2g79rcW Y/VUDa9SuU5Z3TL7kSH0il4UH9LIy/6rDTEftJ9mS8LBYcPJZZI0hey0hhH/NGMHxVzo XuOYuUPS8hcbFH8EHj48a08xDA6Q+iAw6JJpel1BdOKsf1c49H2WURKpGS3VuniqCm5m pPjIrqVWk37XP7Yh6RYxrNuiTNAlLi0Zk3JKnTLeLJykCRiEZ4JeBt5qsI9QTm8TRBRe VvAnG8V9YG9XVPdMlS9ghPbTR+Enq2+WkhlpxWm6Ih3iwA6hkW3KMqMpZY4GNggcl5Bj q3Iw== 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=Pczm5pV4ce46NnVKn/lhZTtihLbgQ4E1txXLjuqPc0E=; b=FHOxur6l/wChDh3nuGpM20WP09Os3XxxnqXPmUJooV2QLcNHXgjlZlyBVZuWBmLb27 mab984GqQV4mczpIBvfAYEb5brtE7H3+D+TgnN4iHT0yXQXb4guZMGTF6J4vy85jlMx1 SPAtmp8OOCOJl8Sfj3mzLT1QS/a7JP/A2YbJw4IyHWud5qGKo8jvPEwjG5L56IM/HdzT wqxoisew3XTCpJ/GDtQmfua3SUZrbCduXMOKIgTh9GOMud6hNTjMLKyBC5MFm6N6yjG3 8USD1MOwBVHMSm2WDk0WnSN+OYrhLRIXA6vpYvboVKYBG0SNZ/x/JfyJ1qRQZZO1Owe9 6Inw== X-Gm-Message-State: AOAM530mBQj0dWL0Sy7yFFB9fFjd4RQDjR8tlPtwCmhJ22BTR1syaMf4 U/WPpRHTJtfvSaWVO/5Xu4gt7g== X-Google-Smtp-Source: ABdhPJyxK42ErdS2kmah5aZm85CBh/CD41S+dBwwyOPE0hGAl+vfZxUxCJcseEZQx5ysZQvLqFaXpg== X-Received: by 2002:a5d:66c9:: with SMTP id k9mr2513305wrw.307.1589525290159; Thu, 14 May 2020 23:48:10 -0700 (PDT) Received: from localhost.localdomain (217-149-172-66.nat.highway.telekom.at. [217.149.172.66]) by smtp.gmail.com with ESMTPSA id 32sm2150228wrg.19.2020.05.14.23.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 23:48:09 -0700 (PDT) Message-ID: Subject: Re: Check what has been done for a uncommitted prepared transaction From: Laurenz Albe To: Andy Fan Cc: Michael Paquier , pgsql-general@lists.postgresql.org Date: Fri, 15 May 2020 08:48:08 +0200 In-Reply-To: References: <20200514080447.GE166343@paquier.xyz> <1e39c06492fe7ee13946d648b5f4749d116b077e.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, 2020-05-15 at 08:09 +0800, Andy Fan wrote: > On Thu, May 14, 2020 at 9:33 PM Laurenz Albe wrote: > > On Thu, 2020-05-14 at 16:26 +0800, Andy Fan wrote: > > > Thanks, actually I don't know how to use prepared transaction and how it works. > > > I care about this because there is a long prepared transaction exists in our customer, > > > and we want to know what this transaction has done(like any data it changed). > > > All the things I know is the data comes from pg_prepared_xact, but it doesn't help a lot. > > > > Idf you have the transaction ID from "pg_prepared_xact", you could check > > what locks are held: > > > > SELECT * FROM pg_locks WHERE transactionid = ...; > > > > Than might give you a clue. > > > > Thanks a lot. this transaction only lock a transactionid lock, so I assume there is nothing > is done in this transaction. > > > locktype | database | relation | page | tuple | virtualxid | transactionid | classid | objid | objsubid | virtualtransaction | pid | mode | granted | fastpath > ---------------+----------+----------+------+-------+------------+---------------+---------+-------+----------+--------------------+------+---------------+---------+---------- > transactionid | | | | | | 1181845808 | | | | -1/1181845808 | | ExclusiveLock | t | f > (1 row) Looks like it, yes. Roll it back then. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com