Bug #40503 Client-server protocol lacks a means to abandon partially processed results
Submitted: 4 Nov 2008 14:55 Modified: 4 Nov 2008 14:56
Reporter: Shawn Green Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S4 (Feature request)
Version:all OS:Any
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D5 (Feature request)

[4 Nov 2008 14:55] Shawn Green
Description:
Within all of our client libraries we have the means to open results in one of two ways:

1) The entire resultset is transmitted to the client in a single large block

2) The restultset is streamed to the client one row at a time. 

If at any time during method 2) the user has determined that they have enough data, there is no way to abandon the remaining rows of the results without actually closing the connection.

How to repeat:
N/A

Suggested fix:
Just as we have a server-client protocol message that means "send me the next row of data" (for example from the C API "mysql_fetch_row()" when used with "mysql_use_results()"), we need to add a command that means "abandon the remaining rows" to the s-c protocol. 

This new command would initiate whatever internal steps are necessary to make the server believe that it has finished sending the remaining rows of the results to the client. 

The advantages to this new command:
* The remaining rows may not need to be actually read from disk, reducing resource contention. 
* The network would not need to transmit the remaining rows, reducing resource contention
* The client can nearly immediately de-allocate any client-side resources used for processing the results, improving client-side memory allocation. Of course, the client would have to wait for the command to return with a success/fail response code. 
* The server does not need to tear down a connection. This leaves all other connection-specific constructs (such as user variable and temporary tables) in place for the client to continue using.
[5 Nov 2008 9:54] Alexander Nozdrin
See also Bug#39519.