Browse code

[core] BM-13725 Fix: use a better suited index type for container_type & direntry_kind

Thomas Cataldo authored on 08/01/2019 09:47:45
Showing 3 changed files
... ...
@@ -59,6 +59,9 @@ public class ContainerStore extends JdbcAbstractStore {
59 59
 		}
60 60
 
61 61
 		public String intern(String s) {
62
+			if (s == null) {
63
+				return s;
64
+			}
62 65
 			String exist = map.putIfAbsent(s, s);
63 66
 			return (exist == null) ? s : exist;
64 67
 		}
... ...
@@ -1,5 +1,7 @@
1 1
 CREATE EXTENSION IF NOT EXISTS hstore WITH schema pg_catalog;
2 2
 
3
+CREATE EXTENSION IF NOT EXISTS btree_gin WITH schema pg_catalog;
4
+
3 5
 CREATE TABLE t_container (
4 6
 	id serial PRIMARY KEY,
5 7
 	uid TEXT NOT NULL unique,
... ...
@@ -14,7 +16,8 @@ CREATE TABLE t_container (
14 16
     domain_uid text NULL,
15 17
     readonly boolean DEFAULT FALSE    
16 18
 );
17
-CREATE INDEX idx_container_type  ON t_container(container_type);
19
+
20
+CREATE INDEX idx_container_type  ON t_container USING gin(container_type);
18 21
 CREATE INDEX idx_container_owner  ON t_container(owner);
19 22
 
20 23
 CREATE TABLE t_container_sequence (
... ...
@@ -2,6 +2,8 @@ CREATE EXTENSION IF NOT EXISTS ltree WITH schema pg_catalog;
2 2
 
3 3
 CREATE EXTENSION IF NOT EXISTS unaccent WITH schema pg_catalog;
4 4
 
5
+CREATE EXTENSION IF NOT EXISTS btree_gin WITH schema pg_catalog;
6
+
5 7
 create type t_directory_entry_account_type as enum ('FULL', 'SIMPLE');
6 8
 
7 9
 create table t_directory_entry (
... ...
@@ -24,4 +26,4 @@ create index idx_t_directory_entry_orgunit_item_id_idx on t_directory_entry (org
24 26
 
25 27
 create index idx_t_directory_entry_displayname on t_directory_entry (displayname);
26 28
 
27
-create index idx_t_directory_entry_kind on t_directory_entry (kind);
29
+create index idx_t_directory_entry_kind on t_directory_entry using gin(kind);