Timeline for Mysql - MyISAM Default order
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 17, 2014 at 13:51 | comment | added | Kondybas |
@jynus Always use ORDER BY if you really need an ordered result. Sorting can significantly impact the performance while unsorted results are quite equivalent in most cases.
|
|
Sep 17, 2014 at 10:21 | comment | added | jynus |
@lourdh Both Kondybas and ypercube are 100% right- tables are sets, not lists, and there is no "ROWID" like in other RDMS. Having said that, for pure optimization, full table scans in MyISAM tend to be done in physical order (roughly the way they were inserted if there were not gaps/deletes) and in primary key order in InnoDB. This is not a rule, just a coincidence, it will change depending on the query and insertion methods, and will vary from server to server. Other engines are even less predictable. Always use ORDER BY .
|
|
Sep 17, 2014 at 9:48 | comment | added | Kondybas | Mysql fetch the rows in some "unknown" order, and sometimes that order is an order rows has been inserted/updated but we can't rely on that assumption. If you want rows to be ordered in some way you should specify how rows should be ordered. Otherwise result is completely unpredictable. | |
Sep 17, 2014 at 9:36 | comment | added | lourdh | Hi Kondybas, but other tables display the data in primary key order by default. I am having this issue in some of my configuration tables(especially MyISAM tables). Also based on your comment I got a doubt, if I didn't specify the order in my select sql, will my result set be retrieved in different order at each retrieval? | |
Sep 17, 2014 at 9:13 | history | answered | Kondybas | CC BY-SA 3.0 |