If only the first page is calculated and the subsequent pages are not used, will this improve efficiency? There is another situation, that is, in the case of fuzzy query, there is an application. I estimate that most of the query results are less than 20, that is, there is only one page of results, so it is unnecessary to calculate the total number, and it is fuzzy. Query efficiency is also relatively low. So I suddenly thought of jumping out of the original thinking, why do we have to calculate the total number of rows first and then get the list? You can query the list first. If the number of list results = 20, then query the total number of rows, because if it is less than 20, there is actually only one page. The total number of rows is equal to the number of list results found. The pseudo code is:
|