Skip to content

Commit 4b82ee3

Browse files
authored
Merge pull request #58 from zinic/BED-7853
feat (pg): introduce edge start/end with kind filter index - BED-7853
2 parents 2380370 + 587e27b commit 4b82ee3

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

drivers/pg/query/sql/schema_up.sql

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ create table if not exists node
107107
alter table node
108108
alter column properties set storage main;
109109

110-
-- Index on the graph ID of each node.
111-
create index if not exists node_graph_id_index on node using btree (graph_id);
110+
-- Remove the old graph ID index.
111+
drop index if exists node_graph_id_index;
112112

113113
-- Index node kind IDs so that lookups by kind is accelerated.
114114
create index if not exists node_kind_ids_index on node using gin (kind_ids);
@@ -176,8 +176,8 @@ execute procedure delete_node_edges();
176176
alter table edge
177177
alter column properties set storage main;
178178

179-
-- Index on the graph ID of each edge.
180-
create index if not exists edge_graph_id_index on edge using btree (graph_id);
179+
-- Remove the old graph ID index.
180+
drop index if exists edge_graph_id_index;
181181

182182
-- Index on the start vertex of each edge.
183183
create index if not exists edge_start_id_index on edge using btree (start_id);
@@ -188,6 +188,11 @@ create index if not exists edge_end_id_index on edge using btree (end_id);
188188
-- Index on the kind of each edge.
189189
create index if not exists edge_kind_index on edge using btree (kind_id);
190190

191+
-- Index lookups that include the edge's start or end id along with a filter for the edge type. This is the most
192+
-- common join filter during traversal.
193+
create index if not exists edge_start_kind_index on edge using btree (start_id, kind_id);
194+
create index if not exists edge_end_kind_index on edge using btree (end_id, kind_id);
195+
191196
-- Path composite type
192197
do
193198
$$

0 commit comments

Comments
 (0)