roam/daily/2022-03-29.org
2022-03-30 09:52:04 -04:00

2.1 KiB

2022-03-29

Get list of subscribers with non-normalized tags on active accounts

Investigating the impact of the new Tag Normalization rules on existing subscribers on active accounts.

Gathering data

I imported a dump of the subscriber_tags table from AppDB as well as the list.subscribers table data for all active accounts (~SELECT s.* FROM list.subscribers s JOIN accounts a ON (a.a_id = s.account_id) WHERE a.status_id < 7~)

I then built a table of subscribers having tags that do not match our validation rules.

  CREATE TABLE invalid_tags AS
  SELECT s.list_id, s.account_id, t.subscriber_id, tag
  FROM subscribers s
  JOIN subscriber_tags as t ON (s.id = t.subscriber_id)
     , unnest(tags) tag
  WHERE tag != normalize_tag(tag)

Subscribers on active accounts

  SELECT COUNT(*) FROM subscribers
count
16650026

Subscribers with invalid tags

  SELECT COUNT(DISTINCT subscriber_id) FROM invalid_tags
count
239291

Accounts with subscribers with invalid tags

  SELECT COUNT(DISTINCT account_id) FROM invalid_tags;
count
16
  SELECT DISTINCT account_id FROM invalid_tags
account_id
1833
211344
13492
212837
216738
213819
16479
215217
104120
215067
213122
14656
111262
214928
44749
91