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 1pzAMa-0007Gs-9w for pgsql-admin@arkaria.postgresql.org; Wed, 17 May 2023 06:10:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pzAMZ-0008Ie-5n for pgsql-admin@arkaria.postgresql.org; Wed, 17 May 2023 06:10: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 1pzAMY-0008IU-NU for pgsql-admin@lists.postgresql.org; Wed, 17 May 2023 06:10:14 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pzAMV-000G5V-W5 for pgsql-admin@lists.postgresql.org; Wed, 17 May 2023 06:10:13 +0000 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-50be17a1eceso597924a12.2 for ; Tue, 16 May 2023 23:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20221208.gappssmtp.com; s=20221208; t=1684303809; x=1686895809; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=HnOXTbEQMSjzCyivrUw4OkZ8LgTJZsGXHfKZ9wBsrPM=; b=w+mCW8aIOgkmBGSCqVqffOp9NUKn4IqRLxs2szelJJSZry0FB1ZH7DpN+irLKWYrwS 4bMCxsILsvv1kll1KdFRSPXIDQVIFHPi7wO5qYmpWnlNeLGCp6Dcrs7t3acj7FCH7tL8 /S9l78rcLCxdpaqF7mM2v4G23nrGWaLFf1veYgrt+N14yHzCP7H6Xyp5jVXYQG/XqUgN uG05kTxVyjblvy1XGGykbRA1xUAfIJuNrjtlxjN8ybeV+YYLlTNBfdRQX59bpJqUZz7m UnRNunciaZGtpLLTWPoIOEJ4IZVEGUKbB5Lj3eYpJL/szX9TzNkyc26fZmZcIaacsnc/ vZTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684303809; x=1686895809; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=HnOXTbEQMSjzCyivrUw4OkZ8LgTJZsGXHfKZ9wBsrPM=; b=HGXYSBV9Wt9nWA60N+7Xx6tjIag2LDkGuj8M3HjWtVWJZKuRklVBGevMpes3Rb7h+Y 32G+8IQp8+sI82DXBt8l9IJw6LGVhJw6Nna/wqeAHDfZqApYGs3VVxNXI2m0EI1d7of9 SHEO8cBMyVVjCChhyoiOb5bxYN9GdYv+4qO89QRXBoy2hTKzuVkG0w6iF+dvXTJ223zp hV07iIHGF0HizT749uVtlDGCWx7ZJXRE4IaS/ZwW8LmYzbCHhVa6FPTa16Q2DOMRpJmw npqdFC3NgAs2MVeRc+xxCjmWPogCvKaVLNwzC3gIG+DqOul4hoKRXjEXscegZ1J0uNuV RxAw== X-Gm-Message-State: AC+VfDwVKTEq4an2RpZbsVo/0a0rHRGsB3ouXMyKEEJHz1zK9ok5bvLM Ar/PiSKSXWEwlMtWg33nEu4MDg== X-Google-Smtp-Source: ACHHUZ6BYskv9Q0ooPtI7DYIrJNadFyoCl/KSgZ4C83weNyz5KQatVIvPRnXzTuXo6a6X0oO9o2l4g== X-Received: by 2002:a17:907:843:b0:94f:5847:8ac with SMTP id ww3-20020a170907084300b0094f584708acmr37955070ejb.51.1684303809527; Tue, 16 May 2023 23:10:09 -0700 (PDT) Received: from localhost.localdomain (178-190-179-50.adsl.highway.telekom.at. [178.190.179.50]) by smtp.gmail.com with ESMTPSA id mh25-20020a170906eb9900b00882f9130eafsm11581891ejb.26.2023.05.16.23.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 23:10:09 -0700 (PDT) Message-ID: Subject: Re: ERROR: could not serialize access due to concurrent update From: Laurenz Albe To: ROHIT SACHDEVA Cc: pgsql-admin@lists.postgresql.org Date: Wed, 17 May 2023 08:10:08 +0200 In-Reply-To: References: <580a59b7e6ef605000c5dde862300e4290d9445a.camel@cybertec.at> <6d2162718b0af8504c5f85013b78dc97a2046d59.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I'm getting a bit tired of reformatting your replies into the correct order= ... On Tue, 2023-05-16 at 22:54 +0530, ROHIT SACHDEVA wrote: > On Tue, 16 May, 2023, 10:05 pm Laurenz Albe, w= rote: > > On Tue, 2023-05-16 at 18:39 +0530, ROHIT SACHDEVA wrote: > > > I am getting this error in the application logs, and this error is fr= equently coming. > > > Could someone suggest what would be the best solution to overcome the= se types of errors. > > > Isolation of the database is read committed. Should I change the isol= ation? > > >=20 > > > Also foreign table scan is there on query. > > >=20 > > > It's a postgres_fdw i am using. > >=20 > > That is normal if you modify any data via FDW, because one local query = can result in several > > foreign queries, which have to see the same snapshot of the data. > >=20 > > Repeat queries that fail that way, and keep your transactions as short = as you can. > > But due to this error our transaction is aborted and application team are= getting these errors in their logs. > > How can I figure this out?=20 > Can there be work around for not getting this error. You should be able to avoid these serialization conflicts by using SELECT .= .. FOR NO KEY UPDATE whenever you read data that you intend to modify later. Yours, Laurenz Albe