Make email deduplication more robust
Author: joebonCreated Jul 30, 2026Updated Aug 19, 2026
Email deduplication (used to avoid sending the same email multiple times when for instance sending reminder emails) is currently brittle and unoptimized:
- Uses non-indexed metadata on
email_logstable to figure out if email has already been sent
Should reasonably be fixed in a 3-step rollout:
- Add a nullable deduplication key column to
email_logs, along with code that populates it for new emails and with a backfill script. Nullable should be kept because not all emails require a deduplication key - Add a partial unique index
- Switch from the current checking to checking the new key
Source: polarsource/polar