1 -- create materialized view if not exists context_node_ngrams_view as
2 -- select context_node_ngrams.context_id, ngrams_id, nodes_contexts.node_id
4 -- join context_node_ngrams
5 -- on context_node_ngrams.context_id = nodes_contexts.context_id;
7 -- create index if not exists context_node_ngrams_view_context_id_idx on context_node_ngrams_view(context_id);
8 -- create index if not exists context_node_ngrams_view_ngrams_id_idx on context_node_ngrams_view(ngrams_id);
9 -- create index if not exists context_node_ngrams_view_node_id_idx on context_node_ngrams_view(node_id);
11 create index if not exists context_node_ngrams_context_id_ngrams_id_idx
on context_node_ngrams(context_id
, ngrams_id
);
12 create index if not exists node_stories_ngrams_id_idx
on node_stories(ngrams_id
);