public inbox for [email protected]  
help / color / mirror / Atom feed
Re: infinite loop in an update statement
2+ messages / 2 participants
[nested] [flat]

* Re: infinite loop in an update statement
@ 2024-09-11 10:14 Fabrice Chapuis <[email protected]>
  2024-09-11 12:29 ` Re: infinite loop in an update statement Greg Sabino Mullane <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Fabrice Chapuis @ 2024-09-11 10:14 UTC (permalink / raw)
  To: pgsql-general

On Tue, Sep 10, 2024 at 4:49 PM Fabrice Chapuis <[email protected]>
wrote:

> no lock, in view pg_stat_activity
>
> status = active
> wait event = NULL
> wait event type = NULL
>
> On Mon, Sep 9, 2024 at 5:00 PM Tom Lane <[email protected]> wrote:
>
>> Fabrice Chapuis <[email protected]> writes:
>> > why this update does not return instantly?
>>
>> > UPDATE table_a a
>> >  SET col1 = (SELECT MIN(b.col1)
>> >                     FROM table_b b
>> >                     WHERE b.col2 = a.col2)
>>
>> Maybe query is waiting for a lock on one of those tables?
>>
>>                         regards, tom lane
>>
>


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: infinite loop in an update statement
  2024-09-11 10:14 Re: infinite loop in an update statement Fabrice Chapuis <[email protected]>
@ 2024-09-11 12:29 ` Greg Sabino Mullane <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Greg Sabino Mullane @ 2024-09-11 12:29 UTC (permalink / raw)
  To: Fabrice Chapuis <[email protected]>; +Cc: pgsql-general

On Wed, Sep 11, 2024 at 6:14 AM Fabrice Chapuis <[email protected]>
wrote:

> status = active
>> wait event = NULL
>> wait event type = NULL
>>
>
That seems quite unlikely. Perhaps you are seeing the pg_stat_activity
query itself? Try this:

select state, now()-state_change, wait_event_type, wait_event, query
from pg_stat_activity where query ~ 'SELECT MIN' and pg_backend_pid() <>
pid;

Cheers,
Greg


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-09-11 12:29 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-09-11 10:14 Re: infinite loop in an update statement Fabrice Chapuis <[email protected]>
2024-09-11 12:29 ` Greg Sabino Mullane <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox