Re: Composite index planner issues Was: Re: [HACKERS] Constraint exclusion oddity with composite index

2007-06-06 Thread Tom Lane
"Joshua D. Drake" <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> That statement seems perfectly accurate to me. > Considering an index of a,b if I search for b I would expect that the > planner could use the index. It can. Whether it will think that's a good idea is another question entirely,

Re: Composite index planner issues Was: Re: [HACKERS] Constraint exclusion oddity with composite index

2007-06-06 Thread Joshua D. Drake
Tom Lane wrote: "Joshua D. Drake" <[EMAIL PROTECTED]> writes: I guess where I got confused is: http://www.postgresql.org/docs/8.1/static/indexes-multicolumn.html And explicitly: A multicolumn B-tree index can be used with query conditions that involve any subset of the index's columns, but t

Re: Composite index planner issues Was: Re: [HACKERS] Constraint exclusion oddity with composite index

2007-06-06 Thread Tom Lane
"Joshua D. Drake" <[EMAIL PROTECTED]> writes: >> I guess where I got confused is: >> >> http://www.postgresql.org/docs/8.1/static/indexes-multicolumn.html >> >> And explicitly: >> >> A multicolumn B-tree index can be used with query conditions that >> involve any subset of the index's columns,

Composite index planner issues Was: Re: [HACKERS] Constraint exclusion oddity with composite index

2007-06-06 Thread Joshua D. Drake
Joshua D. Drake wrote: Tom Lane wrote: "Joshua D. Drake" <[EMAIL PROTECTED]> writes: Tom Lane wrote: "Joshua D. Drake" <[EMAIL PROTECTED]> writes: Assume the following: index on: (id, adate) constraint CHECK(adate > '01-01-2007' AND adate < '04-01-2007'); The planner will not use the index li

Re: [HACKERS] Constraint exclusion oddity with composite index

2007-06-04 Thread Zeugswetter Andreas ADI SD
> >> Assume the following: > >> index on: (id, adate) > >> constraint CHECK(adate > '01-01-2007' AND adate < '04-01-2007'); > > Um, the subject is CE, but the question is about an index ? Those are separate issues. > >> The planner will not use the index listed above. > > For what? > > select

Re: [HACKERS] Constraint exclusion oddity with composite index

2007-06-01 Thread Joshua D. Drake
Tom Lane wrote: "Joshua D. Drake" <[EMAIL PROTECTED]> writes: Tom Lane wrote: "Joshua D. Drake" <[EMAIL PROTECTED]> writes: Assume the following: index on: (id, adate) constraint CHECK(adate > '01-01-2007' AND adate < '04-01-2007'); The planner will not use the index listed above. For what?

Re: [HACKERS] Constraint exclusion oddity with composite index

2007-06-01 Thread Tom Lane
"Joshua D. Drake" <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> "Joshua D. Drake" <[EMAIL PROTECTED]> writes: >>> Assume the following: >>> index on: (id, adate) >>> constraint CHECK(adate > '01-01-2007' AND adate < '04-01-2007'); >>> The planner will not use the index listed above. >> >> For w

Re: [HACKERS] Constraint exclusion oddity with composite index

2007-06-01 Thread Joshua D. Drake
Tom Lane wrote: "Joshua D. Drake" <[EMAIL PROTECTED]> writes: Assume the following: index on: (id, adate) constraint CHECK(adate > '01-01-2007' AND adate < '04-01-2007'); The planner will not use the index listed above. For what? select adate from parent where adate = '01-25-2007' For ex

Re: [HACKERS] Constraint exclusion oddity with composite index

2007-06-01 Thread Tom Lane
"Joshua D. Drake" <[EMAIL PROTECTED]> writes: > Assume the following: > index on: (id, adate) > constraint CHECK(adate > '01-01-2007' AND adate < '04-01-2007'); > The planner will not use the index listed above. For what? regards, tom lane ---(end

[HACKERS] Constraint exclusion oddity with composite index

2007-06-01 Thread Joshua D. Drake
Hello, Assume the following: index on: (id, adate) constraint CHECK(adate > '01-01-2007' AND adate < '04-01-2007'); The planner will not use the index listed above. It does work if we have an index on just timehit in addition to the above. (of course) Is this expected? Joshua D. Drake P.S