Postgres defaults to ID DESC, MySQL defaults to ID ASC

Marnen Laibow-Koser wrote:

What do you think?

I think you don't quite understand how SQL databases retrieve records.

Think of it this way: select * from users; returns a record "set." As in, "unordered set" as apposed to a record "array." An id field is just another column that happens to be used to identify rows. The only requirement (assuming id is used as a primary key) is that each value is unique. The sequence of those values is undefined. Therefore, the order of the record set is undefined.

An "order by" clause is applied to the resulting set before the set is returned, which essentially turns it into an "ordered set/array." This final result is stored in an Array object by ActiveRecord (another ordered storage object) so can be depended upon to be kept in order.