![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
postgres 29304 20209 0 17:37 pts/4 00:00:00 postgres: robert tassiv 192.168.0.250 idle in transaction |
#3
| |||||||||||||
| |||||||||||||
|
|
Almost certainly, that guy is holding the lock REINDEX wants. The VACUUM is probably backed up behind the REINDEX. If you want to convince me it's a deadlock, you'll need to exhibit pg_locks contents. |
|
granted -------------------+----------+----------+-------------+-------+--------------- |
|
t fits | 50033492 | 50032754 | | 29304 | |
|
t files | 50033470 | 50032754 | | 29304 | RowShareLock t files | 50033470 | 50032754 | | 29304 | |
|
t groups | 50033448 | 50032754 | | 29335 | AccessShareLock t groups | 50033448 | 50032754 | | 29335 | RowShareLock t files_file_id_seq | 50033468 | 50032754 | | 29335 | AccessShareLock t obs_id_seq | 50033525 | 50032754 | | 29304 | AccessShareLock t pg_locks | 16759 | 50032754 | | 30797 | AccessShareLock t pairs_pair_id_seq | 50033457 | 50032754 | | 29335 | AccessShareLock t obs_id_seq | 50033525 | 50032754 | | 29335 | AccessShareLock t temp_obs_v | 50033589 | 50032754 | | 29304 | AccessShareLock t temp_obs_v | 50033589 | 50032754 | | 29304 | |
|
t imported | 50033638 | 50032754 | | 29304 | |
|
t temp_obs_i | 50033625 | 50032754 | | 29335 | |
|
t imported | 50033638 | 50032754 | | 29335 | |
|
65952259 | 50032754 | | 29304 | AccessExclusiveLock | t | | 841262 | 29549 | ExclusiveLock t | | 841339 | 30797 | ExclusiveLock t pairs | 50033459 | 50032754 | | 29304 | AccessShareLock t pairs | 50033459 | 50032754 | | 29304 | RowShareLock t pairs | 50033459 | 50032754 | | 29304 | |
|
t pairs | 50033459 | 50032754 | | 29335 | RowShareLock t pairs | 50033459 | 50032754 | | 29335 | |
|
t groups | 50033448 | 50032754 | | 29304 | RowShareLock t | | 841207 | 29304 | ExclusiveLock t | | 841234 | 29335 | ExclusiveLock t files | 50033470 | 50032754 | | 29335 | AccessShareLock t files | 50033470 | 50032754 | | 29335 | RowShareLock t files | 50033470 | 50032754 | | 29335 | |
|
t temp_obs_i | 50033625 | 50032754 | | 29304 | |
|
t fits | 50033492 | 50032754 | | 29335 | AccessShareLock t fits | 50033492 | 50032754 | | 29335 | |
#4
| ||||
| ||||
|
|
tassiv=# select relname, pg_locks.* from pg_locks left join pg_class on ( pg_locks.relation = pg_class.oid ); |
|
temp_obs_i | 50033625 | 50032754 | | 29549 | ShareUpdateExclusiveLock | f |
|
temp_obs_i | 50033625 | 50032754 | | 29335 | AccessExclusiveLock | f |
|
temp_obs_i | 50033625 | 50032754 | | 29304 | AccessShareLock | t temp_obs_i | 50033625 | 50032754 | | 29304 | RowExclusiveLock | t |
#5
| |||
| |||
|
|
so indeed everyone is waiting for this process: postgres 29304 20209 0 17:37 pts/4 00:00:00 postgres: robert tassiv 192.168.0.250 idle in transaction |
|
which is not waiting for any lock but is just sitting on its duff while holding quite a pile of locks. Ergo, no deadlock, just badly written client software. |
|
BTW, the 29335 process is holding rather a large pile of locks itself, way more than I'd expect for a REINDEX alone. It looks like you must be running the REINDEX inside a transaction that has already touched a number of other tables. I'd have to counsel rethinking that --- even though there's no deadlock in this case, you are surely risking deadlocks. Since REINDEX needs an exclusive lock, you should try to minimize the number of other locks you have when you start the REINDEX. |
#6
| |||
| |||
|
|
Tom Lane <tgl (AT) sss (DOT) pgh.pa.us> confessed: so indeed everyone is waiting for this process: postgres 29304 20209 0 17:37 pts/4 00:00:00 postgres: robert tassiv 192.168.0.250 idle in transaction Hmmm... Not sure what that was doing. I'm only running one client. I had just aborted an import, and may have left the client suspended, rather than killing it. |
|
... I'd have to counsel rethinking that --- even though there's no deadlock in this case, you are surely risking deadlocks. Since REINDEX needs an exclusive lock, you should try to minimize the number of other locks you have when you start the REINDEX. Well, I'm inserting single records into 4 tables, updating another using a temp table, importing ~3k records into two tables (each), then joining those last two tables (hence the REINDEX) to get matching entries, then selecting the results into the final table, all in one transaction. |
![]() |
| Thread Tools | |
| Display Modes | |
| |