Re: [HACKERS] Partial index locks

2014-03-22 Thread Thom Brown
On 22 March 2014 05:32, Tom Lane t...@sss.pgh.pa.us wrote: Thom Brown t...@linux.com 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

Re: [HACKERS] Partial index locks

2014-03-22 Thread Tom Lane
Thom Brown t...@linux.com writes: On 22 March 2014 05:32, Tom Lane t...@sss.pgh.pa.us 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

Re: [HACKERS] Partial index locks

2014-03-22 Thread Thom Brown
On 22 March 2014 15:04, Tom Lane t...@sss.pgh.pa.us wrote: Thom Brown t...@linux.com writes: On 22 March 2014 05:32, Tom Lane t...@sss.pgh.pa.us 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.

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 = value. However, when I perform an UPDATE of a single row in a transaction, I've noticed

Re: [HACKERS] Partial index locks

2014-03-22 Thread Thom Brown
On 22 March 2014 16:28, Jim Nasby j...@nasby.net 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 = value. However, when I perform

[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 = value. 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

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 = value. However, when I perform an UPDATE of a single row in a transaction, I've noticed that all those partial indexes show up in

Re: [HACKERS] Partial index locks

2014-03-21 Thread Thom Brown
On 22 March 2014 00:59, Vik Fearing vik.fear...@dalibo.com 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 = value. However, when I perform an UPDATE of a single row in a

Re: [HACKERS] Partial index locks

2014-03-21 Thread Tom Lane
Thom Brown t...@linux.com 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