The Nhibernate profiler shows a lot of error messages in terms of request:
Different parameter sizes lead to inefficient use of the query plan cache
This also leads to an explanation at http://nhprof.com/Learn/Alerts/UncachedQueryPlan and warns you about using the prepare_sql = true
parameter when creating a session. I do it so freely:
.ExposeConfiguration(configuration => configuration .SetProperty("current_session_context_class", "thread_static") .SetProperty("prepare_sql", "true") .SetProperty("generate_statistics", "true") )
But it does not seem to work, as error messages still exist. Is this a limitation on OracleClientConfiguration or am I doing it wrong?
Edit To provide more information about this ...
In my repository I do this
session.Query<TEntity>.Where(predicate).ToList();
and this is a challenge
var value = ParameterRepository.First(p => (p.Pipeline.Id == pipelineId && p.Name == name));
For example, these are two SQL generated from this call, and that the nhibernate profiler shows that "the sizes of the DIfferent parameters lead to inefficient use of the query plan cache"
select GUID1_12_, PARAMETER2_12_, PARAMETER3_12_, GUID4_12_ from (select pipelineex0_.GUID_PIPELINE_EXEC_PARAMETER as GUID1_12_, pipelineex0_.PARAMETER_NAME as PARAMETER2_12_, pipelineex0_.PARAMETER_VALUE as PARAMETER3_12_, pipelineex0_.GUID_PIPELINE_TRACKING as GUID4_12_ from FCT_PIPELINE_EXEC_PARAMETER pipelineex0_ where pipelineex0_.GUID_PIPELINE_TRACKING = 'A5916E73CF1E406DA26F65C24BFBF694' and pipelineex0_.PARAMETER_NAME = 'lid' ) where rownum <= 1
and second
select GUID1_12_, PARAMETER2_12_, PARAMETER3_12_, GUID4_12_ from (select pipelineex0_.GUID_PIPELINE_EXEC_PARAMETER as GUID1_12_, pipelineex0_.PARAMETER_NAME as PARAMETER2_12_, pipelineex0_.PARAMETER_VALUE as PARAMETER3_12_, pipelineex0_.GUID_PIPELINE_TRACKING as GUID4_12_ from FCT_PIPELINE_EXEC_PARAMETER pipelineex0_ where pipelineex0_.GUID_PIPELINE_TRACKING = 'A5916E73CF1E406DA26F65C24BFBF694' and pipelineex0_.PARAMETER_NAME = 'period' ) where rownum <= 1
IMHO is PARAMETER_NAME with a cap and a period that generates different query plans.
early