There are a lot of banner history log IDs that are associated with multiple ct rows. Almost 10% of the last 10,000 rows, in fact.
Are we creating spurious ct rows? That might explain a lot of the null referrers in T161539.
select dupes, count(*) from ( select banner_history_log_id, count(*) as dupes from banner_history_contribution_associations where id > 11293000 group by banner_history_log_id ) as subq group by dupes; +-------+----------+ | dupes | count(*) | +-------+----------+ | 1 | 8905 | | 2 | 703 | | 3 | 98 | | 4 | 42 | | 5 | 21 | | 6 | 12 | | 7 | 8 | | 8 | 5 | | 9 | 3 | | 10 | 1 | | 11 | 1 | +-------+----------+