KamoCRM

Read a drip's lead by its primary key

PerformanceEmailService
Shipped
November 6, 2026 at 6:32 PM UTC
Author
Kamo
Commit
eaa31e4

DripContacts.lead/stateOfLead wrote "l.uid = ? AND l.org_id = ?", which YugabyteDB's heuristic planner serves from ix_leads_org_id, walking the whole organization: 7.15 s per lead on the largest org (EXPLAIN ANALYZE, 2026-11-06). The tenant check is now "l.org_id + 0 = ?": the same filter, but no index can serve it, so the planner reads the lead by leads_pkey (~2-5 ms).

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing