Re: [HACKERS] Partial index locks

2014-03-22 Thread Thom Brown
On 22 March 2014 16:28, Jim Nasby wrote: > On 3/21/14, 7:59 PM, Vik Fearing wrote: >> >> On 03/22/2014 01:43 AM, Thom Brown wrote: >>> >>> Hi, >>> >>> I've created a table with 1000 partial indexes. Each one matches >>> exactly one row based on the predicate WHERE id = . >>> >>> However, when I p

Re: [HACKERS] Partial index locks

2014-03-22 Thread Jim Nasby
On 3/21/14, 7:59 PM, Vik Fearing wrote: On 03/22/2014 01:43 AM, Thom Brown wrote: Hi, I've created a table with 1000 partial indexes. Each one matches exactly one row based on the predicate WHERE id = . However, when I perform an UPDATE of a single row in a transaction, I've noticed that all

Re: [HACKERS] Partial index locks

2014-03-22 Thread Thom Brown
On 22 March 2014 15:04, Tom Lane wrote: > Thom Brown writes: >> On 22 March 2014 05:32, Tom Lane wrote: >>> Yes. You can't determine whether the index needs to get a new entry >>> without examining its metadata, and that's what the lock is mainly about. > >> I see. Why does this apply to delet

Re: [HACKERS] Partial index locks

2014-03-22 Thread Tom Lane
Thom Brown writes: > On 22 March 2014 05:32, Tom Lane wrote: >> Yes. You can't determine whether the index needs to get a new entry >> without examining its metadata, and that's what the lock is mainly about. > I see. Why does this apply to deletes too? The executor doesn't take locks on inde

Re: [HACKERS] Partial index locks

2014-03-22 Thread Thom Brown
On 22 March 2014 05:32, Tom Lane wrote: > Thom Brown writes: >> Is it necessary for a partial index that doesn't include the row to be >> involved in locking? > > Yes. You can't determine whether the index needs to get a new entry > without examining its metadata, and that's what the lock is mai

Re: [HACKERS] Partial index locks

2014-03-21 Thread Tom Lane
Thom Brown writes: > Is it necessary for a partial index that doesn't include the row to be > involved in locking? Yes. You can't determine whether the index needs to get a new entry without examining its metadata, and that's what the lock is mainly about. The only possible alternative would be

Re: [HACKERS] Partial index locks

2014-03-21 Thread Thom Brown
On 22 March 2014 00:59, Vik Fearing wrote: > On 03/22/2014 01:43 AM, Thom Brown wrote: >> Hi, >> >> I've created a table with 1000 partial indexes. Each one matches >> exactly one row based on the predicate WHERE id = . >> >> However, when I perform an UPDATE of a single row in a transaction, >>

Re: [HACKERS] Partial index locks

2014-03-21 Thread Vik Fearing
On 03/22/2014 01:43 AM, Thom Brown wrote: > Hi, > > I've created a table with 1000 partial indexes. Each one matches > exactly one row based on the predicate WHERE id = . > > However, when I perform an UPDATE of a single row in a transaction, > I've noticed that all those partial indexes show up i

[HACKERS] Partial index locks

2014-03-21 Thread Thom Brown
Hi, I've created a table with 1000 partial indexes. Each one matches exactly one row based on the predicate WHERE id = . However, when I perform an UPDATE of a single row in a transaction, I've noticed that all those partial indexes show up in pg_locks with RowExclusiveLock. Only 2 of those ind