On 24 January 2012 09:29, Chris Angelico <rosuav@gmail.com> wrote:
> On Mon, Jan 23, 2012 at 11:17 PM, Douglas Eric <sekkuar@hotmail.com> wrote:
>> I suggest to change this behavior. If one makes a SELECT statement without
>> any ORDER BY, it would be
>> clever to automatically sort by the first primary key found in the query, if
>> any.
I recently submitted a problem report with a product that had that
behaviour. The data involved was a table of database ID's and text
labels for use in a drop-down list. In such cases, sorting the data by
primary key (the ID) is rarely what you want!
For example, if you have a listing of car brands, sorting them by some
arbitrary ID quickly makes such a list impossible to use. You want
such a list sorted alphabetically. Defaulting to sorting by ID (like
aforementioned product did) does not make sense in such a case.
So, this is not just a bad idea from a performance perspective, it's
also often not what you want.
Of course specifying a "different" sort order than the default one
would solve the issue, but that's not the point here.
--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.