Legacy Knowledge Base
Published Jul. 2, 2025

Heavy database queries involving DLFileEntry table

Written By

Roberto Díaz

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

In some cases you could find that your database is spending a lot of time procesing this query:

SELECT fileEntryId, groupId, companyId, userId, userName, createDate, modifiedDate, classNameId, classPK, repositoryId, folderId, treePath, name, extension, mimeType, title, description, extraSettings, fileEntryTypeId, version, size_, readCount, smallImageId, largeImageId, custom1ImageId, custom2ImageId, manualCheckInRequired FROM DLFileEntry WHERE (smallImageId = 1) OR (largeImageId = 1) OR (custom1ImageId = 1) OR (custom2ImageId = 1)

It has 4 OR clauses in its WHERE, so it produces a Full Scan in the table. This is a real example of how it could impact you:

Captura_de_pantalla_2019-10-31_a_las_10.59.39.png

Resolution

You may not need this query to be executed. To test if it's useful to you, run this queries:

select count(*) from DLFileEntry where custom2ImageId > 0;
select count(*) from DLFileEntry where custom1ImageId > 0;
select count(*) from DLFileEntry where largeImageId > 0;
select count(*) from DLFileEntry where smallImageId > 0;

If all of them return 0 as result the original query is not useful and you could reduce it's use by modifiying this property:

web.server.servlet.check.image.gallery

And setting this as false.

Did this article resolve your issue ?

Legacy Knowledge Base