]> Git — Sourcephile - gargantext.git/blob - devops/postgres/tools/removeUnusedNgrams.sql
[MERGE]
[gargantext.git] / devops / postgres / tools / removeUnusedNgrams.sql
1
2 WITH listed AS
3 ( select nn.ngrams_id AS id, count(*) AS c
4 FROM node_node_ngrams nn
5 GROUP BY nn.ngrams_id
6 )
7
8 --SELECT count(*) from listed l
9 -- WHERE
10 --l.c <= 1
11
12
13 DELETE FROM ngrams n
14 USING listed l
15 WHERE
16 n.id = l.id
17 AND l.c <= 1
18 ;
19
20
21