Miscellany
public text v1 · immutableCREATE TABLE logs_cnt
SELECT term,COUNT(term) AS count_term FROM logs GROUP BY term;
ALTER TABLE logs_cnt ADD PRIMARY KEY(term);
update logs a set count=(select count_term b from logs_cnt where a.term=b.term);
DROP TABLE logs_cnt;
OR
update logs a set count=(select count(term) from logs b where a.term=b.term);