Обсуждение: Possible causes for "tuple concurrently updated" error

Поиск
Список
Период
Сортировка

Possible causes for "tuple concurrently updated" error

От
Jacob Scott
Дата:
Hi,

I'm seeing a "tuple concurrently updated" error thrown while executing UPDATE statements. I've attempted to diligently review previous threads on this error (e.g., https://www.google.com/webhp?ie=UTF-8#q=tuple+concurrently+updated+update+site:postgresql.org) but am confused about what classes of queries can conflict to cause this error.
  • It seems clear from previous threads that 
    • two concurrent ANALYZE queries on the same table can cause this this error.
    • some access control/DDL statements (e.g. GRANT) run concurrently can cause this error.
  • Can a "VACUUM ANALYZE $TABLE" (e.g., from autovacuum) concurrent with a "UPDATE $TABLE" cause this error?
  • Can two concurrent "UPDATE $TABLE" queries which touch completely disjoint sets of rows (e.g. where clause on primary key with disjoint filters) cause  this error?
Thanks,

Jacob


Re: Possible causes for "tuple concurrently updated" error

От
Alvaro Herrera
Дата:
On Wed, May 04, 2016 at 11:52:47PM -0700, Jacob Scott wrote:
> Hi,
>
> I'm seeing a "tuple concurrently updated" error thrown while executing
> UPDATE statements. I've attempted to diligently review previous threads on
> this error (e.g.,
> https://www.google.com/webhp?ie=UTF-8#q=tuple+concurrently+updated+update+site:postgresql.org)
> but am confused about what classes of queries can conflict to cause this
> error.

What Postgres version are you running?


--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: Possible causes for "tuple concurrently updated" error

От
Alvaro Herrera
Дата:
Jacob Scott wrote:
> Arg, should have included this in my initial email :-(
>
> 9.3.11

OK.  So what are the updates doing?  Are there any FKs involved?

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: Possible causes for "tuple concurrently updated" error

От
Jacob Scott
Дата:
Arg, should have included this in my initial email :-(

9.3.11

On Thu, May 5, 2016 at 7:46 AM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
On Wed, May 04, 2016 at 11:52:47PM -0700, Jacob Scott wrote:
> Hi,
>
> I'm seeing a "tuple concurrently updated" error thrown while executing
> UPDATE statements. I've attempted to diligently review previous threads on
> this error (e.g.,
> https://www.google.com/webhp?ie=UTF-8#q=tuple+concurrently+updated+update+site:postgresql.org)
> but am confused about what classes of queries can conflict to cause this
> error.

What Postgres version are you running?


--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: Possible causes for "tuple concurrently updated" error

От
Jacob Scott
Дата:
Pinpoint updates of the form

UPDATE $TABLE set field1=$FOO, field2=$BAR ... WHERE pk=$ID
  • All fields are specified
  • Table has no foreign keys (but does have a unmber of indexes)
  • executed as a prepared statement with bind params & data for multiple rows provided


On Thu, May 5, 2016 at 8:13 AM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
Jacob Scott wrote:
> Arg, should have included this in my initial email :-(
>
> 9.3.11

OK.  So what are the updates doing?  Are there any FKs involved?

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services