Search Postgresql Archives

Re: [RFE] auto ORDER BY for SELECT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24 January 2012 09:29, Chris Angelico <rosuav@xxxxxxxxx> wrote:
> On Mon, Jan 23, 2012 at 11:17 PM, Douglas Eric <sekkuar@xxxxxxxxxxx> 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.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux