Skip to content

Batching of statements for SELECT query #5952

Closed as not planned
Closed as not planned

Description

@darius-iko

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)?

Thank you.

Activity

  1. rowanmiller commented on Jul 6, 2016

    @rowanmiller
    Contributor

    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.

  2. roji commented on Jul 6, 2016

    @roji
    Member

    @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.

  3. divega commented on Jul 7, 2016

    @divega
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions