
J.Smith+shop@Gmail.com and jsmith@gmail.com can reach the same inbox. That does not make every dot, plus sign or capital letter disposable. Apply Gmail's rule to a company domain and john.smith@example.com can be a different person from johnsmith@example.com; remove every plus suffix and a perfectly ordinary mailbox whose name contains + can collide with another row.
The useful design is two columns: keep the address exactly as the user supplied it, and derive a separate matching key under rules you can defend. On a made-up list of 20 rows below, that conservative key found all six deliberately repeated rows and merged no people. A popular aggressive recipe made the dedupe number look better—ten rows appeared redundant—but four of those matches were wrong.
What is safe without knowing the provider
RFC 5321 is awkward but clear: a mailbox local part must be treated as case-sensitive, while the domain follows case-insensitive DNS rules. It also discourages providers from exploiting case sensitivity. That is why lowercasing everything often works in practice, but “often” is not enough for a unique key that can attach one person's orders to another person's account.
Provider documentation lets us go further in narrow places. Personal Gmail addresses ignore dots; Google's own page explicitly says dots do matter on work, school and other organization domains. Google documents +word variations, as do Outlook.com and Fastmail. Those promises belong to the named service, not to every domain whose MX happens to point there. A custom-domain administrator can change provider or routing later.
The 20-row test: six good matches, four tempting bad ones
We assigned the following invented rows to 14 invented people. The same labels are the ground truth; separate labels must remain separate. This is not a claim about a production customer list. It is a small fixture you can paste into a test and extend with the providers your application accepts.
The four bad pairs are Sales/sales at the custom domain, the two custom-domain dot variants, the two custom-domain plus variants, and the Outlook dot variants. Outlook documents plus addressing; it does not say dots are ignored. An apparent 50% match rate is therefore worse data than an honest 30%.
A provider-aware canonical expression
The examples below deliberately recognize only the public domains supported by the cited rules. They lowercase personal Gmail local parts, remove Gmail dots and plus tags, map googlemail.com to gmail.com, and remove a plus tag at Outlook.com and Fastmail while preserving the base local part's case. Everything else preserves the local part and lowercases only the domain. Validate that there is exactly one @ before this expression runs; parsing every legal quoted mailbox is a job for an e-mail parser, not split_part.
The SQLite version demonstrates the generated-column mechanism, but it also shows the maintenance cost of encoding policy in string expressions. In a real product, put this behavior in one well-tested application function, save its result, and rebuild keys when the policy version changes. A generated column is attractive when the provider list is deliberately short and schema changes are controlled.
Inspect collisions before adding UNIQUE
Review those groups with account history, verification status and user identifiers. Do not let an index choose the surviving row. Also decide whether a plus address is identity or intent: stripping +billing may be right for dedupe, while keeping the raw address is still necessary for replies, auditing and knowing which sign-up route was used.
A unique canonical key is suitable only when one inbox is allowed one account. It is the wrong constraint for family accounts, shared team inboxes, or systems where the same mailbox may represent several legal entities. In those systems, use the key to propose matches, not to reject inserts.
Three rules that prevent most damage
First, verify the address. Canonicalization predicts delivery equivalence; a successful e-mail code proves control. Second, keep the raw address forever alongside the key. Third, version the policy. If you later add Yahoo, a custom domain, or a new Gmail rule, recompute into email_key_v2, inspect the changed collision groups, then move the index. A quiet in-place rewrite can merge accounts during an ordinary deployment.
Have the addresses in a CSV? csvProfiler shows distinct counts and the most frequent values in your browser, without uploading the file. Use it to size the cleanup before you write an UPDATE.
Open csvProfilerOpen the collision query and the affected rows side by side in Pilotbase, a free database client for Windows, macOS and Linux or Docker on a server.
Get PilotbaseRelated: Addresses and phone numbers that match: normalising them in SQL before you compare · Merging duplicate customers without breaking orders
Sources, checked 7 November 2026: RFC 5321, sections 2.3.11 and 2.4 (the local part is interpreted by its domain and must be preserved; domains are case-insensitive); Gmail Help: dots don't matter (personal Gmail, and the explicit Workspace exception); Google Workspace Learning Center: plus variations; Microsoft Support: site-specific + addresses in Outlook.com; Fastmail: plus and subdomain addressing. The 20-row fixture and calculations are our own.



