Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speedup visit schedule expand queries #320

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/db/index-create.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- authorization:
CREATE INDEX permission_service_method ON permission (service_method);
CREATE INDEX profile_permission_permission_fk_profile_active ON profile_permission (permission_fk,profile,active);
CREATE INDEX user_permission_profile_user_fk_active_profile ON user_permission_profile (user_fk,active,profile);

-- criteria:
CREATE INDEX criterion_property_module_property ON criterion_property (module,property);
Expand Down
2 changes: 1 addition & 1 deletion core/db/schema-set-version.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ begin
end
$$ language plpgsql;

select set_database_version('010801040');
select set_database_version('010801050');
8 changes: 8 additions & 0 deletions core/db/schema-up-master.sql
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,13 @@ if get_database_version() < '010801040' then

end if;

if get_database_version() < '010801050' then

CREATE INDEX user_permission_profile_user_fk_active_profile ON user_permission_profile (user_fk,active,profile);

perform set_database_version('010801050');

end if;

end
$$;
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private static LinkedHashMap<String, Projection> applyExpandDateModeCriterions(o
org.hibernate.Criteria stopTagValuesValueCriteria = stopTagValuesCriteria.createCriteria("value", CriteriaSpecification.LEFT_JOIN);
// from the cross product, remove those with start+stop values of different probands. also include rows without existing stop tag values
visitScheduleItemCriteria.add(CriteriaUtil.applyOr(
Restrictions.or(Restrictions.eqProperty("startTagValues.listEntry.id", "stopTagValues.listEntry.id"), Restrictions.isNull("stopTagValues.listEntry.id")), or));
Restrictions.or(Restrictions.eqProperty("startTagValues.listEntry.id", "stopTagValues.listEntry.id"), Restrictions.isNull("stopTag.id")), or));
// narrow to particular proband, if given
org.hibernate.Criteria startTagValuesListEntryCriteria = startTagValuesCriteria.createCriteria("listEntry", "startTagValuesListEntry", CriteriaSpecification.LEFT_JOIN);
if (probandId != null) {
Expand Down
Loading