Postgres default sort by id – worldship

Rows are returned in an unspecified order, per sql specs, unless you add an order by clause. In Postgres, that means you’ll get rows in, basically, the order that live rows read on the disk.

If you want a consistent order without needing to add an order by clause, create a view as suggested in Jack’s comment.

Leave a Comment