Bug #1709 | DELETE and subsequent INSERTs result in out of order rows | ||
---|---|---|---|
Submitted: | 30 Oct 2003 4:13 | Modified: | 30 Oct 2003 8:22 |
Reporter: | Bob Terrell | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: MyISAM storage engine | Severity: | S3 (Non-critical) |
Version: | 4.0.16 | OS: | MacOS (Mac OS X 10.2.8) |
Assigned to: | CPU Architecture: | Any |
[30 Oct 2003 4:13]
Bob Terrell
[30 Oct 2003 4:16]
Bob Terrell
Also occurs with MySQL 4.0.15-nt. I'm pretty sure this didn't happen several versions ago.
[30 Oct 2003 8:22]
Dean Ellis
Tables do not normally have an "order", per se, so generally if you need rows to be returned in a specific order you should be using an ORDER BY clause in your SELECT statement. InnoDB clustered indexes and using ALTER TABLE tablename ORDER BY columnname with MyISAM do impact the physical ordering but, basically, the reported behaviour is perfectly normal. Thank you
[30 Oct 2003 9:06]
Bob Terrell
Sorry; I was just pretty sure that it used to work the expected way. Unless there's a reason it can't, perhaps you can consider this a feature request. One would expect the order of a table to reflect the order of insert statements.
[2 Apr 2005 3:42]
Congyuan Xu
I'm having the same problem. I agree with Bob Terrell. I expect the rows to be physically inserted in the same order as I submitted. When I do update to the rows in my table, I DELETE all the rows that need to be updated, then insert them back with new values ONE by ONE. Users expecte to see the results shown in the same order as they entered, but the inserted rows out of order PHYSICALLY. Some are in reversed order and some are in correct order. So frustrated!!! What I want is the rows to be inserted into the table physically in the same order as my INSERT query. I did the INSERT query one row each time. I don't understand why MySQL not following my query instruction. MySQL 3.23.58 Using PHP script to do the INSERT and DELETE