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 listed

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, but the index is

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 the

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, and one

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 adate from parent

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 of

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

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 what? select adate from

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? select