Query performance
Loading dataset details loads the list of attached files. This query is very slow:
select repository0_.datasetId as datasetI1_33_0_, repository0_.repositoryfileId as reposito2_39_0_, repository0_.position as position3_0_, repository1_.id as id1_81_1_, repository1_.active as active2_81_1_, repository1_.version as version3_81_1_, repository1_.createdBy as createdB4_81_1_, repository1_.createdDate as createdD5_81_1_, repository1_.lastModifiedBy as lastModi6_81_1_, repository1_.lastModifiedDate as lastModi7_81_1_, repository1_.accessRights as accessRi8_81_1_, repository1_.bibliographicCitation as bibliogr9_81_1_, repository1_.contentType as content10_81_1_, repository1_.created as created11_81_1_, repository1_.creator as creator12_81_1_, repository1_.dateRetrieved as dateRet13_81_1_, repository1_.description as descrip14_81_1_, repository1_.extension as extensi15_81_1_, repository1_.extent as extent16_81_1_, repository1_.folder_id as folder_28_81_1_, repository1_.license as license17_81_1_, repository1_.md5Sum as md18_81_1_, repository1_.originalFilename as origina19_81_1_, repository1_.originalUrl as origina20_81_1_, repository1_.path as path21_81_1_, repository1_.rightsHolder as rightsH22_81_1_, repository1_.sha1Sum as sha23_81_1_, repository1_.size as size24_81_1_, repository1_.subject as subject25_81_1_, repository1_.title as title26_81_1_, repository1_.uuid as uuid27_81_1_, repository1_.height as height1_84_1_, repository1_.orientation as orientat2_84_1_, repository1_.width as width3_84_1_, repository1_.abstract as abstract1_80_1_, repository1_.language as language2_80_1_, repository1_.clazz_ as clazz_1_ from dataset_repositoryfile repository0_ inner join ( select id, active, version, createdBy, createdDate, lastModifiedBy, lastModifiedDate, accessRights, bibliographicCitation, contentType, created, creator, dateRetrieved, description, extension, extent, license, md5Sum, originalFilename, originalUrl, path, rightsHolder, sha1Sum, size, subject, title, uuid, folder_id, null as height, null as orientation, null as width, null as abstract, null as language, 0 as clazz_ from repository_file union select id, active, version, createdBy, createdDate, lastModifiedBy, lastModifiedDate, accessRights, bibliographicCitation, contentType, created, creator, dateRetrieved, description, extension, extent, license, md5Sum, originalFilename, originalUrl, path, rightsHolder, sha1Sum, size, subject, title, uuid, folder_id, height, orientation, width, null as abstract, null as language, 1 as clazz_ from repository_image union select id, active, version, createdBy, createdDate, lastModifiedBy, lastModifiedDate, accessRights, bibliographicCitation, contentType, created, creator, dateRetrieved, description, extension, extent, license, md5Sum, originalFilename, originalUrl, path, rightsHolder, sha1Sum, size, subject, title, uuid, folder_id, null as height, null as orientation, null as width, abstract, language, 2 as clazz_ from repository_document ) repository1_ on repository0_.repositoryfileId=repository1_.id where repository0_.datasetId=81
maybe because of the inner join to a union join?
Please find a better query.