legacy-knowledge-base
公開されました Jul. 2, 2025

DLFileEntry テーブルを含む重いデータベースクエリ

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

learn-legacy-article-disclaimer-text

問題

場合によっては、データベースがこのクエリの処理に多くの時間を費やしていることに気づくかもしれません。

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)

WHEREに4つのOR句があるので、表のフルスキャンを行います。 これは実際に影響を与えることができます。

Captura_de_pantalla_2019-10-31_a_las_10.59.39.png

決議

このクエリを実行する必要はないかもしれません。 役に立つかどうかをテストするには、このクエリを実行します。

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;

すべてのクエリが結果として 0 を返す場合、元のクエリは有用ではないので、このプロパティを変更することで使用量を減らすことができます。

web.server.servlet.check.image.gallery

そして、これを偽物と設定する。

did-this-article-resolve-your-issue

legacy-knowledge-base