summaryrefslogtreecommitdiffstats
path: root/extra/sql_dumps/dump_affiliations.sql
blob: 3371b35c74aff9fb4184bc0d60f0800b32a57b82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE;

COPY (SELECT release_ident.id, release_contrib.raw_affiliation
      FROM release_contrib
      INNER JOIN release_ident ON release_ident.rev_id = release_contrib.release_rev
      WHERE release_ident.is_live = 't' AND release_ident.redirect_id IS NULL 
          AND release_contrib.raw_affiliation IS NOT NULL)
    TO '/tmp/fatcat_affiliations.tsv'
    WITH NULL '';

ROLLBACK;

-- Post processing:
--
--  cut -f2 fatcat_affiliations.tsv | sort -S 4G | uniq -c | sort -nr | gzip > fatcat_affiliations.counts.txt.gz
--  gzip fatcat_affiliations.tsv