1 CREATE TABLE word_frequencies AS
2 (SELECT unnest(make_keywords(v)) as id, sum(count) as count
3 FROM (select svals(name) as v, count(*)from place group by v) cnt
7 select count(make_keywords(v)) from (select distinct postcode as v from place) as w where v is not null;
8 select count(getorcreate_housenumber_id(make_standard_name(v))) from (select distinct housenumber as v from place where housenumber is not null) as w;
10 -- copy the word frequencies
11 update word set search_name_count = count from word_frequencies wf where wf.id = word.word_id;
13 -- and drop the temporary frequency table again
14 drop table word_frequencies;