Kevin Grittner <kgrittn@ymail.com> writes:
> Further testing shows that any UPDATE or DELETE statement acquires
> a RowExclusiveLock on every index on the table and holds it until
> end of transaction, whether or not any rows are affected and
> regardless of whether an index scan or a seqscan is used.� In fact,
> just an EXPLAIN of an UPDATE or DELETE does so.� It is only INSERT
> which releases the locks at the end of the statement.
Hm, possibly the planner is taking those locks. I don't think the
executor's behavior is any different. But the planner only cares about
indexes in SELECT/UPDATE/DELETE, since an INSERT has no interest in
scanning the target table.
regards, tom lane