Recently I've found out that MySQL has a offset
feature. I've been trying to find documentation about the results of offset, or the difference in between offset and the limit variant, but I can't seem to find what I'm looking for.
Lets say I have 10.000 rows in a table and I want 25 results, from row 1.000. As far as I got so far, I could do both to get the same result:
SELECT id,name,description FROM tablename LIMIT 1000,25
SELECT id,name,description FROM tablename LIMIT 25 OFFSET 1000
What I'd like to know is the difference between the two.
- Does this actually do the same or is my understanding wrong?
- Is one slower/faster in larger tables
- Does the result of offset change when I do
WHERE column=1
(say column has >100 different values) - Does the result of offset change when I do
ORDER BY column ASC
(asuming it has random values)
I have the feeling offset skips the first X rows found in the database, disregarding sorting and the where.