]> Git — Sourcephile - gargantext.git/blob - devops/postgres/tools/removeUnusedDocuments.sql
[VERSION] +1 to 0.0.6.9.9.4.4
[gargantext.git] / devops / postgres / tools / removeUnusedDocuments.sql
1
2 WITH repeated AS
3 (
4 select nn.context_id AS id, count(*) AS c
5 FROM nodes_contexts nn
6 GROUP BY nn.context_id
7 )
8
9 DELETE FROM contexts c
10 USING repeated r
11 WHERE
12 c.id = r.id
13 AND r.c = 1
14 AND c.typename = 4
15 ;
16