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

[HACKERS] Partial-index predicate proofs got dumber in 9.2

2012-11-15 Thread Tom Lane
I looked into the optimization regression reported here: http://archives.postgresql.org/pgsql-performance/2012-11/msg00140.php It's easy to reproduce the problem in the regression database: create index ti on tenk1 (fivethous) where fivethous is not null; explain select * from int4_tbl, tenk1 whe

Re: [HACKERS] Partial index on date column

2003-03-07 Thread Hannu Krosing
Christopher Kings-Lynne kirjutas R, 07.03.2003 kell 07:28: > Yeah, it's not really a problem for me, I just put the extra clause in. > > Is indexing excluding NULLs a common application of partial indexes? For me it is ;) > It's > basically all I use it for, when a column has like 90-95% NULLS

Re: [HACKERS] Partial index on date column

2003-03-06 Thread Christopher Kings-Lynne
> The optimizer does not think that "pbx_date = CURRENT_DATE" satisfies the > partial index's WHERE condition. I don't see any really good way around > this; to improve matters there'd need to be some concept of a plan that > is only good for a limited time. It's the same as the slight issue I ha

Re: [HACKERS] partial index on system indexes?

2002-07-24 Thread Tom Lane
Tatsuo Ishii <[EMAIL PROTECTED]> writes: > Once I thought of a conversion lookup cache, but it seems impossible > to implent it since the cache needs to be invalidated when the schema > search path is changed. On the contrary, that seems very easy to do. There is a hook to let you get control wh

Re: [HACKERS] partial index on system indexes?

2002-07-24 Thread Tatsuo Ishii
> This sounds like a really bad idea to me. A syscache based on a partial > index is almost certainly not going to work. > > Before we invest in a lot of effort making bootstrap, syscache, and who > knows what else support partial indexes, I want to see a very clear > explanation why we must do

Re: [HACKERS] partial index on system indexes?

2002-07-24 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > In private email with Tatsuo, I learned it is for the new loadable > encoding patch, and he wants to use the index from the syscache. The > reason for the partial index is because the index itself would not be > unique, but a partial index would be uniq

Re: [HACKERS] partial index on system indexes?

2002-07-23 Thread Tom Lane
Tatsuo Ishii <[EMAIL PROTECTED]> writes: > It seems bootstrap parser(bootparse.y) does not accept partial index > definitions. Is there any reason for this? Why should it? The boot parser need handle only a minimal set of operations. Why is there any need to handle partial indexes there?

Re: [HACKERS] partial index on system indexes?

2002-07-23 Thread Bruce Momjian
Tatsuo Ishii wrote: > It seems bootstrap parser(bootparse.y) does not accept partial index > definitions. Is there any reason for this? In private email with Tatsuo, I learned it is for the new loadable encoding patch, and he wants to use the index from the syscache. The reason for the partial i

Re: [HACKERS] partial index on system indexes?

2002-07-23 Thread Bruce Momjian
Tatsuo Ishii wrote: > It seems bootstrap parser(bootparse.y) does not accept partial index > definitions. Is there any reason for this? Probably just because we never needed them. We could add it, or just create the index later in the initdb script. That later seems easier. -- Bruce Momjian

[HACKERS] partial index on system indexes?

2002-07-22 Thread Tatsuo Ishii
It seems bootstrap parser(bootparse.y) does not accept partial index definitions. Is there any reason for this? -- Tatsuo Ishii ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourE

Re: AW: [HACKERS] partial index

2001-08-06 Thread Tom Lane
"Zeugswetter Andreas SB SD" <[EMAIL PROTECTED]> writes: >> Since bid is not in an index the evaluation of usability obviously >> should not be based on index ops ? Actually, now that I think about it, there's no reason that the prover couldn't try a simple equal() on a WHERE clause and predicate

Re: AW: [HACKERS] partial index

2001-08-06 Thread Tom Lane
"Zeugswetter Andreas SB SD" <[EMAIL PROTECTED]> writes: > Since bid is not in an index the evaluation of usability obviously > should not be based on index ops ? Feel free to reimplement the theorem-prover, taking special care to be able to prove things about operators that you have zero informa

RE: AW: [HACKERS] partial index

2001-08-06 Thread Zeugswetter Andreas SB SD
> > test=# create index myindex on accounts(aid) where bid <> 0; > > > Hmm ? Am I reading correctly ? a restriction that is on a field, that > > is not in the index ? Does that make sense ? > > Yes it does, and in fact it's one of the more important applications of > partial indexes. It's the

Re: AW: [HACKERS] partial index

2001-08-06 Thread Tom Lane
"Zeugswetter Andreas SB SD" <[EMAIL PROTECTED]> writes: >> Tatsuo Ishii <[EMAIL PROTECTED]> writes: > test=# create index myindex on accounts(aid) where bid <> 0; > Hmm ? Am I reading correctly ? a restriction that is on a field, that > is not in the index ? Does that make sense ? Yes it does,

AW: [HACKERS] partial index

2001-08-06 Thread Zeugswetter Andreas SB SD
> Tatsuo Ishii <[EMAIL PROTECTED]> writes: > > test=# create index myindex on accounts(aid) where bid <> 0; Hmm ? Am I reading correctly ? a restriction that is on a field, that is not in the index ? Does that make sense ? (aid --> bid) > The original implementation would have refused to let y

Re: [HACKERS] partial index

2001-08-05 Thread Tom Lane
Tatsuo Ishii <[EMAIL PROTECTED]> writes: > test=# create index myindex on accounts(aid) where bid <> 0; > test=# explain select * from accounts where aid < 10 and bid <> 0; > and I got a log message: > DEBUG: clause_pred_clause_test: unknown pred_op > Is this normal? Yes. We might want to s

[HACKERS] partial index

2001-08-05 Thread Tatsuo Ishii
I have created a test data using pgbench, played with the partial index. test=# create index myindex on accounts(aid) where bid <> 0; CREATE test=# explain select * from accounts where aid < 10 and bid <> 0; and I got a log message: DEBUG: clause_pred_clause_test: unknown pred_op Is this norm