Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-15 Thread Jay Levitt
Craig Ringer wrote: it's a *bit* of a tiny use case. It certainly is. Jay -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-15 Thread Tom Lane
Mike Christensen writes: > BTW, this table (RecipeMetadata) will only ever be used in a join. I > will never query it directly. But I'll query Recipes and join in > RecipeMetadata. In that case possibly you want the join key to be the index payload. regards, tom lane -

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-15 Thread Mike Christensen
On Thu, Dec 15, 2011 at 6:00 AM, Craig Ringer wrote: > On 12/15/2011 03:53 PM, Alban Hertroys wrote: >> >> Correct, but... >> That's not a particularly useful index to create. That index just contains >> values of true where the associated column equals true - you're storing the >> same informatio

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-15 Thread Craig Ringer
On 12/15/2011 03:53 PM, Alban Hertroys wrote: Correct, but... That's not a particularly useful index to create. That index just contains values of true where the associated column equals true - you're storing the same information twice. It could be very handy if you have an extremely high selec

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-15 Thread Albe Laurenz
Mike Christensen wrote: > For the boolean column Foo in Table1, if I want to index all values of > TRUE, is this syntax correct? > > CREATE INDEX IDX_MyIndex ON Table1(Foo) WHERE Foo; Yes, that is correct. Yours, Laurenz Albe -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-14 Thread Alban Hertroys
On 15 Dec 2011, at 5:43, Mike Christensen wrote: > For the boolean column Foo in Table1, if I want to index all values of > TRUE, is this syntax correct? > > CREATE INDEX IDX_MyIndex ON Table1(Foo) WHERE Foo; > > The query: > > SELECT * FROM Table1 WHERE Foo; > > should use the index, and: >

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-14 Thread Mike Christensen
On Wed, Dec 14, 2011 at 9:54 PM, Mike Christensen wrote: >> For the boolean column Foo in Table1, if I want to index all values of >> TRUE, is this syntax correct? >> >> CREATE INDEX IDX_MyIndex ON Table1(Foo) WHERE Foo; >> >> The query: >> >> SELECT * FROM Table1 WHERE Foo; >> >> should use the i

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-14 Thread Mike Christensen
> For the boolean column Foo in Table1, if I want to index all values of > TRUE, is this syntax correct? > > CREATE INDEX IDX_MyIndex ON Table1(Foo) WHERE Foo; > > The query: > > SELECT * FROM Table1 WHERE Foo; > > should use the index, and: > > SELECT * FROM Table1 WHERE NOT Foo; > > should not, c

[GENERAL] Correct syntax to create partial index on a boolean column

2011-12-14 Thread Mike Christensen
For the boolean column Foo in Table1, if I want to index all values of TRUE, is this syntax correct? CREATE INDEX IDX_MyIndex ON Table1(Foo) WHERE Foo; The query: SELECT * FROM Table1 WHERE Foo; should use the index, and: SELECT * FROM Table1 WHERE NOT Foo; should not, correct? I just want t