diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-08-17 17:12:26 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2015-08-19 15:47:20 +0100 |
commit | 5c79337ad423cd7fc3cada9b7830d90726387987 (patch) | |
tree | 61615747eae7483722bea4c94309ef4d1cddac4c /db/schema.sql | |
parent | f5d6ec933c9fd4d57f9b56fec27f7c746a0706b9 (diff) |
Simplify/consolidate body restriction db code.
Make dashboard work properly in two-tier councils, showing reports sent
to both. Create an index on the array of the bodies_str column to speed
up performance, and use that throughout the code replacing all LIKE
scans. This also enables a simplifying tidy of the restriction code.
Diffstat (limited to 'db/schema.sql')
-rw-r--r-- | db/schema.sql | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/db/schema.sql b/db/schema.sql index 5d42d57cf..ea2698b0e 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -207,6 +207,7 @@ create index problem_state_latitude_longitude_idx on problem(state, latitude, lo create index problem_user_id_idx on problem ( user_id ); create index problem_external_body_idx on problem(lower(external_body)); create index problem_radians_latitude_longitude_idx on problem(radians(latitude), radians(longitude)); +create index problem_bodies_str_array_idx on problem USING gin(regexp_split_to_array(bodies_str, ',')); create table questionnaire ( id serial not null primary key, |