Re: [ADMIN] Useless index

2002-02-14 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Tom, do we have a TODO item here? > > I'm not excited about it; it seems a weird case and there's a simple > query change to get the right thing to happen. AFAICS we'd have to > expend a lot of planner cycles to detect this case, an

Re: [ADMIN] Useless index

2002-02-14 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Tom, do we have a TODO item here? I'm not excited about it; it seems a weird case and there's a simple query change to get the right thing to happen. AFAICS we'd have to expend a lot of planner cycles to detect this case, and most of the time those cyc

Re: [ADMIN] Useless index

2002-02-14 Thread Bruce Momjian
Brian McCane wrote: > On Thu, 14 Feb 2002, Tom Lane wrote: > > > Bruce Momjian <[EMAIL PROTECTED]> writes: > > > In fact, I am unsure why you are specifying the primary column in the > > > ORDER BY anyway if you know it will be a single value, except perhaps to > > > try and get it to use the ind

Re: [ADMIN] Useless index

2002-02-14 Thread Jean-Luc Lachance
Here is another peeve Having to specify the type of a constant in a SELECT DISTINCT 'foo'... I which I had more spare time to contribute... Jean-Luc Tom Lane wrote: > > Bruce Momjian <[EMAIL PROTECTED]> writes: > > In fact, I am unsure why you are specifying the primary column in the > > ORD

Re: [ADMIN] Useless index

2002-02-14 Thread Brian McCane
On Thu, 14 Feb 2002, Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > In fact, I am unsure why you are specifying the primary column in the > > ORDER BY anyway if you know it will be a single value, except perhaps to > > try and get it to use the index, right? > > Exactly. The sor

Re: [ADMIN] Useless index

2002-02-14 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > In fact, I am unsure why you are specifying the primary column in the > ORDER BY anyway if you know it will be a single value, except perhaps to > try and get it to use the index, right? Exactly. The sort ordering of the index is (col1,col2) while the

Re: [ADMIN] Useless index

2002-02-14 Thread Bruce Momjian
Tom Lane wrote: > Brian McCane <[EMAIL PROTECTED]> writes: > > CREATE INDEX foo_index ON foo (bazid, score desc) ; > > > Which would be exactly what I want, and would complete in a split second. > > Instead, this thing runs FOREVER (okay, it just seems that way to my > > client :). Is there any

Re: [ADMIN] Useless index

2002-02-14 Thread Tom Lane
Brian McCane <[EMAIL PROTECTED]> writes: > Then I tried your way (after I realized I had already selected a > specific bazid so it didn't matter if it was descending :), Yup, that's the little flash of insight that the planner is incapable of having :-( regards, tom lane

Re: [ADMIN] Useless index

2002-02-14 Thread Tom Lane
Brian McCane <[EMAIL PROTECTED]> writes: > CREATE INDEX foo_index ON foo (bazid, score desc) ; > Which would be exactly what I want, and would complete in a split second. > Instead, this thing runs FOREVER (okay, it just seems that way to my > client :). Is there any way to get the equivalent in

Re: [ADMIN] Useless index

2002-02-14 Thread Brian McCane
On Thu, 14 Feb 2002, Tom Lane wrote: > Brian McCane <[EMAIL PROTECTED]> writes: > > CREATE INDEX foo_index ON foo (bazid, score desc) ; > > > Which would be exactly what I want, and would complete in a split second. > > Instead, this thing runs FOREVER (okay, it just seems that way to my > > clie