Optimize query plan call count

Description

Currently, the entity query plan is resolved twice for every query.

First, when getting the ParameterMetadata:

final QueryImpl query = new QueryImpl( this, getQueryPlan( queryString, false ).getParameterMetadata(), queryString );

Second, in resultClassChecking:

// make sure the query is a select -> HHH-7192 final HQLQueryPlan queryPlan = getFactory().getQueryPlanCache().getHQLQueryPlan( hqlQuery.getQueryString(), false, getLoadQueryInfluencers().getEnabledFilters() );

If we add the QueryPlan to the QueryImpl we could get it without resolving it in resultClassChecking.

Activity

Show:

Sanne GrinoveroApril 26, 2021 at 1:31 PM

Backported to 5.4.x

Nathan XuDecember 13, 2019 at 4:28 AM

another possibility is to pass the generated HQLQueryPlan out of the first method to the second one without changing QueryImpl. It should be pretty easy to do that for everything is happening in one class. Changing QueryImpl has some global compatibility concern, though.

Nathan XuDecember 11, 2019 at 2:43 AM

Fixed

Details

Assignee

Reporter

Components

Priority

Created November 3, 2018 at 6:19 AM
Updated April 29, 2021 at 11:42 AM
Resolved April 26, 2021 at 1:31 PM

Flag notifications