phantom007 — 2012-04-17T04:41:45-04:00 — #1
I have a simple table in my database called 'avatars'
CREATE TABLE `avatars` (
`avatar_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`avatar_image_name` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`avatar_id`)
) ENGINE=MYISAM AUTO_INCREMENT=60 DEFAULT CHARSET=latin1
Which has some data in it.
When I run a simple select query:
LIMIT 0 , 30
What order does it follow to show the resultset? As u can see from the attached screenshot that the autoincrement id column is not in serial order.
Please explain this.
r937 — 2012-04-17T05:30:36-04:00 — #2
it's really simple
without an ORDER BY clause, the database engine is allowed to return rows in whatever sequence it wishes
phantom007 — 2012-04-17T07:15:05-04:00 — #3
I know but what I want to know is that does it have any internal logic at all?
r937 — 2012-04-17T08:56:55-04:00 — #4
it returns them in the sequence it finds them
phantom007 — 2012-04-17T22:35:23-04:00 — #5
But logically should not it find the records in the sequence it was inserted?
r937 — 2012-04-17T23:15:32-04:00 — #6
no, because the insertion takes place on the most readily available disc space, which could be anywhere in the sequence
phantom007 — 2012-04-18T00:42:40-04:00 — #7
Where did you find this info sir? coz I was unble to see any such info in the official document
r937 — 2012-04-18T02:40:17-04:00 — #8
you're gonna have an even harder time finding anything that contradicts it