 
 CREATE INDEX tree_element_instance_index
   ON tree_element (instance_id);
+
 CREATE INDEX instance_path_index
   ON tree_element (instance_path);
 

     n.simple_name                                                                             AS simple_name,
     coalesce(n.name_element, '?')                                                             AS name_element,
     ipath.instance_path                                                                       AS tree_path,
     regexp_replace(ipath.instance_path, 'x', '', 'g')                                         AS instance_path,
     ipath.name_path                                                                           AS name_path,
     ipath.depth                                                                               AS depth,
     'APNI'                                                                                    AS source_shard,

DROP INDEX IF EXISTS tree_simple_name_index;
DROP INDEX IF EXISTS tree_name_path_index;
DROP INDEX IF EXISTS tree_tree_path_index;
DROP INDEX IF EXISTS instance_path_index;
DROP INDEX IF EXISTS tree_synonyms_index;
DROP INDEX IF EXISTS tree_version_element_element_index;
DROP INDEX IF EXISTS tree_version_element_version_index;
