Re: Optimizer picks an ineffient plan - Mailing list pgsql-general

From Tom Lane
Subject Re: Optimizer picks an ineffient plan
Date
Msg-id 4375.1062643465@sss.pgh.pa.us
Whole thread Raw
In response to Re: Optimizer picks an ineffient plan  (Greg Stark <gsstark@mit.edu>)
Responses Re: Optimizer picks an ineffient plan
List pgsql-general
Greg Stark <gsstark@mit.edu> writes:
> "Bupp Phillips" <hello@noname.com> writes:
>> select * from customer order by customer_id, first_name;
>> [ where customer_id is the primary key ]

> However you do have a point. In this case I don't think postgres even
> considers using the index.

It will not, since the index does not appear to provide the correct sort
order.

> However I'm not sure I see a lot of cases where this would come up.

Yes, that's the real crux of the matter.  Should the optimizer spend
cycles on *every* query to detect cases where the user has written
useless sort keys?  I've got grave doubts that it's a win.  ISTM such
an optimization penalizes the folk who write their queries well to
benefit those who are careless.

            regards, tom lane

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Using oids
Next
From: Tom Lane
Date:
Subject: Re: absolute value fro timestamps