Data in different Order
I have Three environments, Test, Development and Production.
We are using the same production backup to refresh the Test, Dev database.
And trying to select from one table without order by clause,
Select * from table_a;
Test and Production are giving data with same order, but in Development its in different order. Only Primary key is there and no other index are there with this table. Everything looks similar for this table in all the environments.
Is there any specific reason that retrives data in different order.
you can only guarantee order by using the order by clause
data isnt stored in order so the database will return it in any way it sees fit
Primary key will not make any difference? I believe that the primary key will re-arrange the data in physical storage based on the key values. Is that wrong?
no, its just a primary key, has nothing to do with storage
heap tables have no order, its why they are called heaps.
Click Here to Expand Forum to Full Width