is Spring JDBC found_rows secure?

Source: Internet
Author: User

This is written in many paging programs:

SELECT COUNT (*) from ' table ' WHERE ...; Find out the total number of records that meet the criteria select * from ' table ' WHERE ... limit m,n; Query the data to be displayed on the page such statements can be changed to: Sql1:select sql_calc_found_rows * from ' table ' WHERE ... limit M, N;
Sql2:select found_rows ();
So as long as the execution of a more time-consuming complex query can get the same number of records with no limit, but this kind of processing I fear is unsafe "guess, not verified": in the case of connection pool, when the SQL1 execution end, if the buffer value in the SQL2 is removed quickly, it is basically correct, However, if there are other processes taking this intermediate result at this point, it is clear that the result of the SQL2 query is incorrect. So, Scenario 1 is safer than Scenario 2? Let me have the time to verify the next.

is Spring JDBC found_rows secure?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.