Paging SQL optimization

The original sql code is as follows

  group by t2.id

          

         ) d

         WHERE ROWNUM <= #{maxRow}       

         )  

WHERE RN >= #{minRow}  

The speed is very slow. The test shows that group by will affect the speed, but it must be group by, otherwise the java code must be changed, which is very troublesome.

After some trade-offs, I decided to change sql haha

Putting paging sql into the main table doubles the speed. solve.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326569401&siteId=291194637