Now the development system involves querying by page. when doing this, I am thinking, whether or not the query SQL statement can be automatically encapsulated by parameters into the ability to count the data size of the query statement that is not queried by page. for example, the general practice is: 1. first query based on the concatenated SQL statement: select * fromecs_goodswheregoods_type1limit1000, 102. count again: selectcount (*) fromecs_goodswheregoods_type1 then we can get the paging-related data. now the logic is: 1... sqlmysql programmer data
Now the development system involves querying by page. when doing this, I am thinking, whether or not the query SQL statement can be automatically encapsulated by parameters into the ability to count the data size of the query statement that is not queried by page. for example, the general practice is:
1. first query based on the concatenated SQL statement: select * from ecs_goods where goods_type = 1 limit 1000, 10
2. count again: select count (*) from ecs_goods where goods_type = 1
Then we can get the paging data.
The logic is as follows:
1. the programmer writes an SQL statement with a query: select * from ecs_goods where goods_type = 1
2. the programmer passes in the paging information parameter and obtains the following information: limit, 10
3. The program automatically concatenates the following two steps: select count (*) from (select * from ecs_goods where goods_type = 1)
Will the query speed and performance vary greatly between the two methods? Why?