Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
haskell-gargantext
haskell-gargantext
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Christian Merten
  • haskell-gargantexthaskell-gargantext
  • Repository

Switch branch/tag
  • haskell-gargantext
  • devops
  • postgres
  • tools
  • removeUnusedNgrams.sql
Find file
BlameHistoryPermalink
  • Alexandre Delanoë's avatar
    [TOOLING] sql queries to remove unused documents and ngrams from database.... · 1a951db1
    Alexandre Delanoë authored 3 years ago
    [TOOLING] sql queries to remove unused documents and ngrams from database. Usage: use a crontab to execute it every week for instance.
    1a951db1
removeUnusedNgrams.sql 258 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

WITH listed AS
  ( select nn.ngrams_id AS id, count(*) AS c
    FROM node_node_ngrams nn 
    GROUP BY nn.ngrams_id
  )

--SELECT count(*) from listed l
-- WHERE
--l.c <= 1


DELETE FROM ngrams n 
  USING listed l
  WHERE
  n.id = l.id
  AND l.c <= 1
; 


Replace removeUnusedNgrams.sql

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.