Efcore: Parameter-specific evaluation in ParameterExtractor and compiled queries

Created on 6 Dec 2019  路  3Comments  路  Source: dotnet/efcore

When executing normal queries, ParameterExtractor is invoked every time, and performs evaluations on parameters. However, with compiled queries the ParameterExtractor is invoked only once, so these evaluations do not take place. This raises some questions:

  • Do we have any code in the pipeline which assumes evaluations have taken place? If so, queries would succeed when executed normally but fail as compiled queries.
  • At least in theory, the lack of evaluation in compiled queries could make them slower than normal queries. We could make client-side evaluation for compiled queries work by having ParameterExtractor register evaluations as lambdas to be invoked each time a query is executed.

Originally discussed in https://github.com/aspnet/EntityFrameworkCore/pull/19189#discussion_r354852354

area-perf area-query needs-design type-enhancement

Most helpful comment

We could make client-side evaluation for compiled queries work by having ParameterExtractor register evaluations as lambdas to be invoked each time a query is executed.

That is what true funcletizer is.

All 3 comments

We could make client-side evaluation for compiled queries work by having ParameterExtractor register evaluations as lambdas to be invoked each time a query is executed.

That is what true funcletizer is.

I guess I finally figured it out then :)

This would also enable using properties over DbContext inside query.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

ryanwinter picture ryanwinter  路  3Comments

bgribaudo picture bgribaudo  路  3Comments

iberodev picture iberodev  路  3Comments

miguelhrocha picture miguelhrocha  路  3Comments