I have two instances of a web application that runs on two different servers.
When I hit the database with identical queries, the result differ in the order of the records in the result set. On one of the servers the result is returned in the order that they were inserted, on the other server the result appears to be close to random.
I have double checked with sql plus to make sure that the data is identical and that they appear to be in the same order.
I read somewhere that the order of the result set obtained by the execution of a select statement can not be guaranteed.
I have some 17 tables in my database and all but one of the tables return the result in the order that the records are stored, using sqlldr, when a select statement is executed
Is there no way to be sure that I get the result in the same order as they are stored in the table in the database?
Doing an order by on a table with many rows does feel like a performance hog.
If there is an index on the column(s) you want the data ordered by, and you specify ORDER BY those columns, then the optimizer may well use that index to order the records.
If you leave off the ORDER BY, you may find that you get the records back in the order you want - or you may not. Even if it works this time, it might not next time. If the order is important, use ORDER BY.