diff --git a/swh/provenance/postgresql/provenance.py b/swh/provenance/postgresql/provenance.py --- a/swh/provenance/postgresql/provenance.py +++ b/swh/provenance/postgresql/provenance.py @@ -93,7 +93,6 @@ try: if urls: sql = """ - LOCK TABLE ONLY origin; INSERT INTO origin(sha1, url) VALUES %s ON CONFLICT DO NOTHING """ @@ -128,7 +127,6 @@ try: if origins: sql = """ - LOCK TABLE ONLY revision; INSERT INTO revision(sha1, origin) (SELECT V.rev AS sha1, O.id AS origin FROM (VALUES %s) AS V(rev, org) @@ -178,7 +176,6 @@ # non-null information srcs = tuple(set((sha1,) for (sha1, _, _) in rows)) sql = f""" - LOCK TABLE ONLY {src_table}; INSERT INTO {src_table}(sha1) VALUES %s ON CONFLICT DO NOTHING """ @@ -189,7 +186,6 @@ # non-null information dsts = tuple(set((sha1,) for (_, sha1, _) in rows)) sql = f""" - LOCK TABLE ONLY {dst_table}; INSERT INTO {dst_table}(sha1) VALUES %s ON CONFLICT DO NOTHING """ @@ -254,7 +250,6 @@ try: if data: sql = f""" - LOCK TABLE ONLY {entity}; INSERT INTO {entity}(sha1, date) VALUES %s ON CONFLICT (sha1) DO UPDATE SET date=LEAST(EXCLUDED.date,{entity}.date) diff --git a/swh/provenance/sql/40-funcs.sql b/swh/provenance/sql/40-funcs.sql --- a/swh/provenance/sql/40-funcs.sql +++ b/swh/provenance/sql/40-funcs.sql @@ -99,7 +99,6 @@ join_location text; begin if src_table in ('content'::regclass, 'directory'::regclass) then - lock table only location; insert into location(path) select V.path from tmp_relation_add as V @@ -113,15 +112,14 @@ end if; execute format( - 'lock table only %s; - insert into %s + 'insert into %s select S.id, ' || select_fields || ' from tmp_relation_add as V inner join %s as S on (S.sha1 = V.src) inner join %s as D on (D.sha1 = V.dst) ' || join_location || ' on conflict do nothing', - rel_table, rel_table, src_table, dst_table + rel_table, src_table, dst_table ); end; $$; @@ -254,14 +252,13 @@ as $$ begin execute format( - 'lock table only %s; - insert into %s + 'insert into %s select S.id, D.id from tmp_relation_add as V inner join %s as S on (S.sha1 = V.src) inner join %s as D on (D.sha1 = V.dst) on conflict do nothing', - rel_table, rel_table, src_table, dst_table + rel_table, src_table, dst_table ); end; $$; @@ -422,7 +419,6 @@ on_conflict text; begin if src_table in ('content'::regclass, 'directory'::regclass) then - lock table only location; insert into location(path) select V.path from tmp_relation_add as V @@ -448,8 +444,7 @@ end if; execute format( - 'lock table only %s; - insert into %s + 'insert into %s select S.id, ' || select_fields || ' from tmp_relation_add as V inner join %s as S on (S.sha1 = V.src) @@ -457,7 +452,7 @@ ' || join_location || ' ' || group_entries || ' on conflict ' || on_conflict, - rel_table, rel_table, src_table, dst_table + rel_table, src_table, dst_table ); end; $$; @@ -641,15 +636,14 @@ end if; execute format( - 'lock table only %s; - insert into %s + 'insert into %s select S.id, ' || select_fields || ' from tmp_relation_add as V inner join %s as S on (S.sha1 = V.src) inner join %s as D on (D.sha1 = V.dst) ' || group_entries || ' on conflict ' || on_conflict, - rel_table, rel_table, src_table, dst_table + rel_table, src_table, dst_table ); end; $$;