inserts and select

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MihirShah
    New Member
    • Jan 2007
    • 3

    inserts and select

    If I insert rows in a table with no index, is select guaranteed to return the rows in the order it was inserted.
    Note: I am not doing any updates, deletes - pure inserts.
    In my small test that I did, it always retrieves in the order I inserted. But not sure if there are any case where it can retrieve in a different order.
  • michaelb
    Recognized Expert Contributor
    • Nov 2006
    • 534

    #2
    I think you should not make any assumptions about the default select order.
    If you have no idexes, and you did not run any UPDATEs on the table you may find that in most cases you get your result sorted by ROWID (that is in the same order the rows were created).
    However there's no quarantee that this would be always the case; just as you cannot expect that ROWIDs are always in sync with the INSERT order.

    Comment

    • MihirShah
      New Member
      • Jan 2007
      • 3

      #3
      Originally posted by michaelb
      I think you should not make any assumptions about the default select order.
      If you have no idexes, and you did not run any UPDATEs on the table you may find that in most cases you get your result sorted by ROWID (that is in the same order the rows were created).
      However there's no quarantee that this would be always the case; just as you cannot expect that ROWIDs are always in sync with the INSERT order.
      thanks for your reply. That's exactly what I want to find out under what circumstances will this happen ? If I am inserting let's say 1000 rows in one transaction, under what circumstances will the ROWIDs will not be in sync with the insert order ?

      Comment

      Working...