mysql
mysql copied to clipboard
Prepared statements: fetching a limited number of rows
When issuing a text query, the server immediately sends all rows to the client. This is not avoidable. However, there is a mechanism in the protocol to prevent this in binary resultsets. Make use of this feature so the user can decide whether to fetch immediately all the rows or fetch them progressively.
When implementing this, it is important to provide performance benchmarks in the docs, comparing this cursor approach vs. the "read everything in one go" approach. Suggested:
- Time to first row
- Overall time to consume the entire resultset
- Time elapsed if resultset should be discarded before being complete