Skip to content

Commit c1eb882

Browse files
add new indexes (#1510)
* add new indexes and change the case_field statistics * Update V20241003_5510_1__CCD-5510_Create_new_indexes.sql * Update V20241003_5510_1__CCD-5510_Create_new_indexes.sql * Update V20241003_5510_2__CCD-5510_Update_case_field_statistics.sql --------- Co-authored-by: bharatkumarpatel1 <Bharatkumar.Patel1@HMCTS.NET>
1 parent f324c7c commit c1eb882

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_state_case_type_id ON public.state USING btree (case_type_id);
2+
3+
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_complex_field_acl_case_field_id ON public.complex_field_acl USING btree (case_field_id);
4+
5+
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_event_acl_event_id ON public.event_acl USING btree (event_id);
6+
7+
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_state_acl_state_id_id ON public.state_acl USING btree (state_id, id);
8+
9+
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_search_party_case_type_id ON public.search_party USING btree (case_type_id);
10+
11+
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_case_type_lower_reference_version_desc ON public.case_type USING btree (LOWER(reference), version DESC);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTER TABLE public.case_field ALTER COLUMN case_type_id SET STATISTICS 1000;
2+
3+
ANALYZE public.case_field;

repository/src/test/java/uk/gov/hmcts/ccd/definition/store/repository/CaseTypeObjectGraphTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,14 @@ public void saveCaseType() {
195195

196196
// Check states
197197
assertThat(fetched.getStates(), hasSize(2));
198-
final StateEntity fetchedState1 = fetched.getStates().get(0);
198+
199+
StateEntity fetchedState1 = new StateEntity();
200+
for (StateEntity state : fetched.getStates()) {
201+
if (state.getReference().equals("stateId")) {
202+
fetchedState1 = state;
203+
}
204+
}
205+
199206
assertThat(fetchedState1.getReference(), equalTo("stateId"));
200207
assertThat(fetchedState1.getLiveFrom(), equalTo(TODAY));
201208
assertThat(fetchedState1.getLiveTo(), equalTo(TOMORROW));

0 commit comments

Comments
 (0)