You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
The EF Core release has batch statements for insert update delete query for single roundtrip to DB in order to speed up app performance. Does it also apply for multiple SELECT or entities queries or combined query (e.g. INSERT, UPDATE and SELECT)?
This isn't something we would do, because it requires reading all the data from one result set before reading the next. With separate commands we can stream data from both results sets.
@rowanmiller, note that reading one result set after the other makes a lot of sense in many scenarios - sometimes you just want the results of 2 unrelated queries in one roundtrip. At the very least this is supported at the ADO.NET level. Also, in non-MARS providers (such as Npgsql) there's no other alternative (i.e. you can't read both result sets at the same time).
I'm not saying EFCore should support this - I don't think it makes much sense for an O/RM and I haven't the slightest idea as to what the API would look like - just that the capability itself does make sense to me.
As @roji mentions we already serialize and buffer query execution when a single source query translates into multiple SELECT statements (e.g. with collection includes) and when MARS isn't available.
@anpete and I have talked about the possibility of generalizing that to other cases, including:
buffering when MARS would otherwise be needed for executing multiple queries
in a similar fashion to the NHibernate Futures feature (which supposedly has performance benefits I would like us to understand better).
I am not sure what the priority should be or if there is any fundamental reason for it not to work but on the surface it seems executing multiple SELECT statements in a batch could be possible (and potentially be useful) for some of the cases above.
Activity
rowanmiller commentedon Jul 6, 2016
This isn't something we would do, because it requires reading all the data from one result set before reading the next. With separate commands we can stream data from both results sets.
roji commentedon Jul 6, 2016
@rowanmiller, note that reading one result set after the other makes a lot of sense in many scenarios - sometimes you just want the results of 2 unrelated queries in one roundtrip. At the very least this is supported at the ADO.NET level. Also, in non-MARS providers (such as Npgsql) there's no other alternative (i.e. you can't read both result sets at the same time).
I'm not saying EFCore should support this - I don't think it makes much sense for an O/RM and I haven't the slightest idea as to what the API would look like - just that the capability itself does make sense to me.
divega commentedon Jul 7, 2016
As @roji mentions we already serialize and buffer query execution when a single source query translates into multiple SELECT statements (e.g. with collection includes) and when MARS isn't available.
@anpete and I have talked about the possibility of generalizing that to other cases, including:
I am not sure what the priority should be or if there is any fundamental reason for it not to work but on the surface it seems executing multiple SELECT statements in a batch could be possible (and potentially be useful) for some of the cases above.