Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
7.2.X, 7.3.X, Master
-
7.3.x, 7.2.x
-
Committed
-
3
-
Performance
Description
Reproduction steps:
- Set up a portal
- Create a new site
- Generate 100000 basic web contents
- Create a new structure (add some dummy fields)
- Create a few web contents based on the structure
- Execute the following Groovy script, with replaced structureKey, companyId, groupId:
import com.liferay.dynamic.data.mapping.service.DDMStructureLocalServiceUtil; import java.util.List; import com.liferay.dynamic.data.mapping.model.DDMStructure; import java.util.ArrayList; import com.liferay.journal.service.JournalArticleLocalServiceUtil; import com.liferay.portal.kernel.workflow.WorkflowConstants; String structureKey = "1151700"; List<Long> folderIds = new ArrayList<>(); long companyId=20101; long groupId=34753 JournalArticleLocalServiceUtil.search(companyId, groupId, folderIds, 0, null, null, structureKey, null, null, null, WorkflowConstants.STATUS_APPROVED, null, -1, -1, null);
Expected behavior: the query is executed relatively quickly, in less than 1 second.
Actual behavior: the query takes a few seconds to finish.
Notes:
- When you debug into JournalArticleFinderImpl.doFindByC_G_F_C_A_V_T_D_C_S_T_D_R(..), you can read the query from the sql variable. You can see that it joins to JournalArticleLocalization table, even though none of its fields are actually used in the where conditions or in the ORDER BY statement.
LPS-109979already solved a similar problem, just with other queries. My guess is that the same would be possible for these complex queries as well.