I'm proposing a new connection string option named BufferResultSets that will read all Result Sets into memory upon calling ExecuteReader and ExecuteReaderAsync. It would default to false and would have to be explicitly enabled.
The intended use case is for ORMs that need to support the SQL Server-like feature Multiple Active Result Sets. MySQL does not support MARS, but by buffering all result sets and clearing the active reader, the connection will be open to service another reader. Since ORMs typically end up reading all results into memory anyways, this should not add much extra memory overhead.
There is a couple ways this could be implemented:
Simple: If BufferResultSets is set, immediately buffer all result sets into memory upon calling ExecuteReaderAsync
Complex: If a connection receives a call while there is an active reader, first buffer the active reader into memory in order to clear the reader, then service the next call
No objections to this proposal. The "Simple" approach sounds best to me; it doesn't seem like a bad idea to buffer the data immediately if the user has opted-in to it.
I'm proposing a new connection string option named
BufferResultSets
that will read all Result Sets into memory upon callingExecuteReader
andExecuteReaderAsync
. It would default tofalse
and would have to be explicitly enabled.The intended use case is for ORMs that need to support the SQL Server-like feature Multiple Active Result Sets. MySQL does not support MARS, but by buffering all result sets and clearing the active reader, the connection will be open to service another reader. Since ORMs typically end up reading all results into memory anyways, this should not add much extra memory overhead.
There is a couple ways this could be implemented:
BufferResultSets
is set, immediately buffer all result sets into memory upon callingExecuteReaderAsync
Logic to buffer result sets already exists in MySqlClient/Results/ResultSet.cs
This option would remove the need for SynchronizedMySqlDataReader.cs in
Pomelo.EntityFrameworkCore.MySql
.@bgrainger @kagamine
The text was updated successfully, but these errors were encountered: