Home > database >  Mysql limit problem
Mysql limit problem

Time:10-31

A simple statement

1) SELECT * FROM TABLE LIMIT 0, 10
2) SELECT * FROM TABLE LIMIT 10, 20

Which two statements are not added sort I want to ask next in table data unchanged, under the condition of 1 2 this 2 sentence every time the query result is the same, please, that is, if 1 execution is 10 times every time the results are the same because no sorting is a fixed order?

CodePudding user response:

The
refer to the original poster sky reply: my world

a simple statements
1) SELECT * FROM TABLE LIMIT 0, 10
2) SELECT * FROM TABLE LIMIT 10, 20

Which two statements are not added sort I want to ask next in table data unchanged, under the condition of 1 2 this 2 sentence every time the query result is the same, please, that is, if 1 execution is 10 times every time the results are the same because no sorting is a fixed order?

The same, according to the selected store order

CodePudding user response:

According to the primary key of the order to you,
Because mysql innodb tables, default is clustered index table,

CodePudding user response:

1, 2, 3, 4, 5 5 records
The kagyu, deleted 3, added, 6, 7, do not waste a space, delete the data do not produce the premise of the location of the mobile data is stored in the disk
Now the order is
1,2,6,4,5,7,


Limit 0, 3=& gt; 1,2,6
The limit of 3, 6=& gt; 4, 5, 7

If there is no limit,
Are likely to delete 3, mobile after 4, 5, it would be 1,2,4,5,6,7, if the amount of data is very big, this is

CodePudding user response:

The
reference 3 floor p270228163 response:
1, 2, 3, 4, 5 5 records
The kagyu, deleted 3, added, 6, 7, do not waste a space, delete the data do not produce the premise of the location of the mobile data is stored in the disk
Now the order is
1,2,6,4,5,7,


Limit 0, 3=& gt; 1,2,6
The limit of 3, 6=& gt; 4, 5, 7

If there is no limit,
Very likely delete 3, mobile after 4, 5, it would be 1,2,4,5,6,7, if the amount of data is very big, this is

CodePudding user response:

reference 1st floor wandier response:
Quote: refer to the original poster sky my world response:

a simple statements
1) SELECT * FROM TABLE LIMIT 0, 10
2) SELECT * FROM TABLE LIMIT 10, 20

Which two statements are not added sort I want to ask next in table data unchanged, under the condition of 1 2 this 2 sentence every time the query result is the same, please, that is, if 1 execution is 10 times every time the results are the same because no sorting is a fixed order?

Constant, elected in store order

CodePudding user response:

reference 1st floor wandier response:
Quote: refer to the original poster sky my world response:

a simple statements
1) SELECT * FROM TABLE LIMIT 0, 10
2) SELECT * FROM TABLE LIMIT 10, 20

Which two statements are not added sort I want to ask next in table data unchanged, under the condition of 1 2 this 2 sentence every time the query result is the same, please, that is, if 1 execution is 10 times every time the results are the same because no sorting is a fixed order?

Constant, elected in store order



You try ali cloud RDS mysql database,
After deleting records, insert data,

CodePudding user response:

Select * real constant hammer order; But two days before encountered a similar problem: changing the select * to select id (primary key), then the query results are not consistent with the insertion order , estimates associated with index of storage, so I think when querying data should not be dependent on the insertion order,
Principle of compaction hammer, it... Great god of all stripes is beyond my ability range, also please answer
  • Related