> ## Documentation Index
> Fetch the complete documentation index at: https://docs.myfundingmachine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Convex index audit 2026 05 17

# Convex Index Audit

> Static read-only audit of `convex/`. Generated by `scripts/audit-convex-indexes.ts`.
>
> **No runtime code or schema was modified.** This report is a snapshot — re-run the
> script to refresh it.

* **Generated:** `2026-05-17T08:30:46.361Z`
* **Schema source:** `convex/schema.ts`
* **Convex files scanned:** 179
* **Tables declared:** 96 (with 298 total indexes)
* **Tables with zero indexes:** 1
* **Queries:** 879 total — 799 use `.withIndex(...)`, 80 look like table scans
* **`.collect()` calls:** 190 total — 167 bounded (scoped by `.withIndex(...)` or capped by `.take(N)`), 23 unbounded

***

## A. Tables & indexes

| Table                              | Index                                        | Fields                                    |
| ---------------------------------- | -------------------------------------------- | ----------------------------------------- |
| `ghlInstallations`                 | `by_company`                                 | `companyId`                               |
| `ghlInstallations`                 | `by_location`                                | `locationId`                              |
| `ghlInstallations`                 | `by_createdAt`                               | `createdAt`                               |
| `ghlInstallations`                 | `by_expiresAt`                               | `expiresAt`                               |
| `roundRobinState`                  | `by_locationId`                              | `locationId`                              |
| `leadReassignmentAudits`           | `by_locationId_and_createdAt`                | `locationId`, `createdAt`                 |
| `users`                            | `by_user_id`                                 | `userId`                                  |
| `organizations`                    | `by_location`                                | `locationId`                              |
| `organizationMemberships`          | `by_org`                                     | `orgId`                                   |
| `organizationMemberships`          | `by_user_org`                                | `userId`, `orgId`                         |
| `creditReportRequests`             | `by_request`                                 | `requestId`                               |
| `creditReportRequests`             | `by_requestId_locationId`                    | `requestId`, `locationId`                 |
| `creditReportRequests`             | `by_contact`                                 | `contactId`                               |
| `creditReportRequests`             | `by_company`                                 | `companyId`                               |
| `creditReportRequests`             | `by_location`                                | `locationId`                              |
| `creditReportRequests`             | `by_createdAt`                               | `createdAt`                               |
| `creditReportRequests`             | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `stitchCreditTokens`               | *(no indexes)*                               | —                                         |
| `underwritingResults`              | `by_report`                                  | `reportId`                                |
| `underwritingResults`              | `by_contact`                                 | `contactId`                               |
| `underwritingResults`              | `by_location`                                | `locationId`                              |
| `underwritingResults`              | `by_createdAt`                               | `createdAt`                               |
| `underwritingResults`              | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `cards`                            | `by_recordId`                                | `recordId`                                |
| `cards`                            | `by_cardType`                                | `cardType`                                |
| `fundingPlans`                     | `by_contact`                                 | `contactId`                               |
| `fundingPlans`                     | `by_location`                                | `locationId`                              |
| `fundingPlans`                     | `by_contact_location`                        | `contactId`, `locationId`                 |
| `fundingPlans`                     | `by_createdAt`                               | `createdAt`                               |
| `fundingPlans`                     | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `columnConfigs`                    | `by_location_table`                          | `locationId`, `tableType`                 |
| `savedFilters`                     | `by_location_page`                           | `locationId`, `pageType`                  |
| `zohoVerticalAccounts`             | `by_org`                                     | `zohoOrgId`                               |
| `zohoInstallations`                | `by_location`                                | `locationId`                              |
| `zohoInstallations`                | `by_org`                                     | `zohoOrgId`                               |
| `migrationJobs`                    | `by_location`                                | `locationId`                              |
| `migrationJobs`                    | `by_status`                                  | `status`                                  |
| `migrationJobs`                    | `by_location_status`                         | `locationId`, `status`                    |
| `migrationLogs`                    | `by_job`                                     | `jobId`                                   |
| `migrationLogs`                    | `by_zoho_record`                             | `zohoRecordId`                            |
| `migrationLogs`                    | `by_job_status`                              | `jobId`, `status`                         |
| `crmStageFixRuns`                  | `by_createdAt`                               | `createdAt`                               |
| `crmStageFixRuns`                  | `by_status`                                  | `status`                                  |
| `crmStageFixRuns`                  | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `migratedContacts`                 | `by_ghl_contact`                             | `ghlContactId`                            |
| `migratedContacts`                 | `by_location`                                | `locationId`                              |
| `migratedContacts`                 | `by_zoho_record`                             | `zohoRecordId`                            |
| `migratedContacts`                 | `by_location_source`                         | `locationId`, `dataSource`                |
| `migratedContacts`                 | `by_validation_status`                       | `locationId`, `dateValidationStatus`      |
| `dateAuditTrail`                   | `by_ghl_contact`                             | `ghlContactId`                            |
| `dateAuditTrail`                   | `by_location`                                | `locationId`                              |
| `dateAuditTrail`                   | `by_job`                                     | `migrationJobId`                          |
| `dateAuditTrail`                   | `by_field`                                   | `ghlContactId`, `fieldName`               |
| `onboardingProgress`               | `by_location`                                | `locationId`                              |
| `onboardingCalls`                  | `by_location`                                | `locationId`                              |
| `onboardingCalls`                  | `by_location_type`                           | `locationId`, `callType`                  |
| `slackInvites`                     | `by_location`                                | `locationId`                              |
| `communityAccessSettings`          | `by_location`                                | `locationId`                              |
| `locationSettings`                 | `by_location`                                | `locationId`                              |
| `aiAgentRuns`                      | `by_location_and_createdAt`                  | `locationId`, `createdAt`                 |
| `aiAgentRuns`                      | `by_location_and_useCase_and_createdAt`      | `locationId`, `useCase`, `createdAt`      |
| `aiAgentRuns`                      | `by_status_and_createdAt`                    | `status`, `createdAt`                     |
| `aiAgentRuns`                      | `by_approvalState_and_createdAt`             | `approvalState`, `createdAt`              |
| `contactInvoiceAgreementOverrides` | `by_locationId_contactId`                    | `locationId`, `contactId`                 |
| `locationGhlMappings`              | `by_location`                                | `locationId`                              |
| `customValues`                     | `by_location`                                | `locationId`                              |
| `zohoLeads`                        | `by_org`                                     | `zohoOrgId`                               |
| `zohoLeads`                        | `by_location`                                | `locationId`                              |
| `zohoLeads`                        | `by_zoho_record`                             | `zohoRecordId`                            |
| `zohoLeads`                        | `by_org_record`                              | `zohoOrgId`, `zohoRecordId`               |
| `zohoDeals`                        | `by_org`                                     | `zohoOrgId`                               |
| `zohoDeals`                        | `by_location`                                | `locationId`                              |
| `zohoDeals`                        | `by_zoho_record`                             | `zohoRecordId`                            |
| `zohoDeals`                        | `by_org_record`                              | `zohoOrgId`, `zohoRecordId`               |
| `zohoCreditReports`                | `by_org`                                     | `zohoOrgId`                               |
| `zohoCreditReports`                | `by_location`                                | `locationId`                              |
| `zohoCreditReports`                | `by_zoho_record`                             | `zohoRecordId`                            |
| `zohoCreditReports`                | `by_org_record`                              | `zohoOrgId`, `zohoRecordId`               |
| `zohoCreditReports`                | `by_lead`                                    | `zohoLeadId`                              |
| `zohoCreditReports`                | `by_deal`                                    | `zohoDealId`                              |
| `setterCommissionSettings`         | `by_location`                                | `locationId`                              |
| `setterCommissionSettings`         | `by_location_ghl_user`                       | `locationId`, `ghlUserId`                 |
| `locationCommissionDefaults`       | `by_location`                                | `locationId`                              |
| `closerCommissionSettings`         | `by_location`                                | `locationId`                              |
| `closerCommissionSettings`         | `by_location_ghl_user`                       | `locationId`, `ghlUserId`                 |
| `fundingMachinesDeals`             | `by_zoho_record`                             | `zohoRecordId`                            |
| `fundingMachinesDeals`             | `by_org`                                     | `zohoOrgId`                               |
| `fundingMachinesDeals`             | `by_org_record`                              | `zohoOrgId`, `zohoRecordId`               |
| `fundingMachinesDeals`             | `by_closer`                                  | `closerId`                                |
| `fundingMachinesDeals`             | `by_appointment_event`                       | `appointmentEventId`                      |
| `fundingMachinesDeals`             | `by_lead_built_contact`                      | `leadBuiltContactId`                      |
| `fundingMachinesDeals`             | `by_contact_phone`                           | `contactPhone`                            |
| `fundingMachinesDeals`             | `by_contact_email`                           | `contactEmail`                            |
| `ghlSubscriptions`                 | `by_location`                                | `locationId`                              |
| `ghlSubscriptions`                 | `by_syncedAt`                                | `syncedAt`                                |
| `ghlSubscriptions`                 | `by_location_syncedAt`                       | `locationId`, `syncedAt`                  |
| `ghlSubscriptions`                 | `by_location_status_syncedAt`                | `locationId`, `status`, `syncedAt`        |
| `ghlSubscriptions`                 | `by_location_subscription`                   | `locationId`, `ghlSubscriptionId`         |
| `ghlSubscriptions`                 | `by_status`                                  | `status`                                  |
| `ghlSubscriptions`                 | `by_contact`                                 | `contactId`                               |
| `ghlSubscriptions`                 | `by_contact_email`                           | `contactEmail`                            |
| `salesCommissions`                 | `by_zoho_record_type`                        | `zohoRecordId`, `eventType`               |
| `salesCommissions`                 | `by_setter`                                  | `setterId`                                |
| `salesCommissions`                 | `by_setter_period`                           | `setterId`, `payPeriodStart`              |
| `salesCommissions`                 | `by_location`                                | `locationId`                              |
| `salesCommissions`                 | `by_location_statusChangedAt`                | `locationId`, `statusChangedAt`           |
| `salesCommissions`                 | `by_location_period`                         | `locationId`, `payPeriodStart`            |
| `salesCommissions`                 | `by_pay_period`                              | `payPeriodStart`, `isPaid`                |
| `salesCommissions`                 | `by_org`                                     | `zohoOrgId`                               |
| `closerCommissions`                | `by_zoho_record`                             | `zohoRecordId`                            |
| `closerCommissions`                | `by_closer`                                  | `closerId`                                |
| `closerCommissions`                | `by_closer_period`                           | `closerId`, `payPeriodStart`              |
| `closerCommissions`                | `by_location`                                | `locationId`                              |
| `closerCommissions`                | `by_location_period`                         | `locationId`, `payPeriodStart`            |
| `closerCommissions`                | `by_pay_period`                              | `payPeriodStart`, `isPaid`                |
| `closerCommissions`                | `by_org`                                     | `zohoOrgId`                               |
| `processingSubmissions`            | `by_contact`                                 | `contactId`                               |
| `processingSubmissions`            | `by_location`                                | `locationId`                              |
| `processingSubmissions`            | `by_contact_location`                        | `contactId`, `locationId`                 |
| `processingSubmissions`            | `by_status`                                  | `status`                                  |
| `processingSubmissions`            | `by_location_status`                         | `locationId`, `status`                    |
| `processingSubmissions`            | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `processingSubmissionComments`     | `by_submission`                              | `submissionId`                            |
| `processingSubmissionComments`     | `by_contact_location`                        | `contactId`, `locationId`                 |
| `contactPipelineStates`            | `by_location`                                | `locationId`                              |
| `contactPipelineStates`            | `by_contact_location`                        | `contactId`, `locationId`                 |
| `contactPipelineStates`            | `by_contact_location_pipeline`               | `contactId`, `locationId`, `pipelineType` |
| `documents`                        | `by_contact`                                 | `contactId`                               |
| `documents`                        | `by_contact_location`                        | `contactId`, `locationId`                 |
| `documents`                        | `by_location`                                | `locationId`                              |
| `documents`                        | `by_type`                                    | `fileType`                                |
| `documents`                        | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `documents`                        | `by_ghlDocumentId`                           | `ghlDocumentId`                           |
| `documents`                        | `by_ghlReferenceId`                          | `ghlReferenceId`                          |
| `documents`                        | `by_externalUrl`                             | `externalUrl`                             |
| `documentUploadTokens`             | `by_token`                                   | `token`                                   |
| `documentUploadTokens`             | `by_contact`                                 | `contactId`                               |
| `documentUploadTokens`             | `by_location`                                | `locationId`                              |
| `termLoanSubmissions`              | `by_contact`                                 | `contactId`                               |
| `termLoanSubmissions`              | `by_contact_location`                        | `contactId`, `locationId`                 |
| `termLoanSubmissions`              | `by_location`                                | `locationId`                              |
| `termLoanSubmissions`              | `by_location_submittedAt`                    | `locationId`, `submittedAt`               |
| `termLoanSubmissions`              | `by_status`                                  | `status`                                  |
| `termLoanSubmissions`              | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `termLoanSubmissions`              | `by_leadUuid`                                | `leadUuid`                                |
| `termLoanSubmissions`              | `by_offersResultsUuid`                       | `offersResultsUuid`                       |
| `termLoanLeadEvents`               | `by_engineEventId`                           | `engineEventId`                           |
| `termLoanLeadEvents`               | `by_leadUuid`                                | `leadUuid`                                |
| `termLoanLeadEvents`               | `by_submissionId`                            | `submissionId`                            |
| `termLoanLeadEvents`               | `by_leadUuid_eventCreatedAt`                 | `leadUuid`, `eventCreatedAt`              |
| `engineAnalyticsCursors`           | `by_endpoint`                                | `endpoint`                                |
| `termLoanDrafts`                   | `by_location_contact`                        | `locationId`, `contactId`                 |
| `processingFees`                   | `by_contact`                                 | `contactId`                               |
| `processingFees`                   | `by_location`                                | `locationId`                              |
| `processingFees`                   | `by_contact_location`                        | `contactId`, `locationId`                 |
| `processingFees`                   | `by_status`                                  | `status`                                  |
| `processingFees`                   | `by_location_status`                         | `locationId`, `status`                    |
| `contactInvoices`                  | `by_locationId_contactId`                    | `locationId`, `contactId`                 |
| `contactInvoices`                  | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `contactInvoices`                  | `by_invoiceId`                               | `invoiceId`                               |
| `operatorInvoices`                 | `by_contact_location_createdAt`              | `contactId`, `locationId`, `createdAt`    |
| `operatorInvoices`                 | `by_status`                                  | `status`                                  |
| `operatorInvoices`                 | `by_dueDate`                                 | `dueDate`                                 |
| `operatorInvoices`                 | `by_location_status`                         | `locationId`, `status`                    |
| `operatorInvoices`                 | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `billingCharges`                   | `by_location_created`                        | `locationId`, `createdAt`                 |
| `billingCharges`                   | `by_request`                                 | `requestId`                               |
| `billingCharges`                   | `by_event`                                   | `eventId`                                 |
| `locationBillingConfig`            | `by_location`                                | `locationId`                              |
| `billingAlerts`                    | `by_status`                                  | `status`                                  |
| `billingAlerts`                    | `by_location`                                | `locationId`                              |
| `billingAlerts`                    | `by_location_status`                         | `locationId`, `status`                    |
| `billingRetryQueue`                | `by_status_retry`                            | `status`, `nextRetryAt`                   |
| `billingRetryQueue`                | `by_formSubmission`                          | `formSubmissionId`                        |
| `supportTickets`                   | `by_status`                                  | `status`                                  |
| `supportTickets`                   | `by_location`                                | `locationId`                              |
| `supportTickets`                   | `by_location_status`                         | `locationId`, `status`                    |
| `supportTickets`                   | `by_contact`                                 | `contactId`                               |
| `supportSignals`                   | `by_source_and_sourceId`                     | `source`, `sourceId`                      |
| `supportSignals`                   | `by_status_and_updatedAt`                    | `status`, `updatedAt`                     |
| `supportSignals`                   | `by_classification_and_updatedAt`            | `classification`, `updatedAt`             |
| `supportSignals`                   | `by_linearIssueKey`                          | `linearIssueKey`                          |
| `supportVerifications`             | `by_signalId_and_createdAt`                  | `signalId`, `createdAt`                   |
| `supportVerifications`             | `by_classification_and_createdAt`            | `classification`, `createdAt`             |
| `supportClusters`                  | `by_signature`                               | `signature`                               |
| `supportClusters`                  | `by_status_and_lastSeen`                     | `status`, `lastSeen`                      |
| `supportClusters`                  | `by_status_and_count`                        | `status`, `count`                         |
| `supportDraftReplies`              | `by_signalId_and_createdAt`                  | `signalId`, `createdAt`                   |
| `supportDraftReplies`              | `by_status_and_updatedAt`                    | `status`, `updatedAt`                     |
| `supportApprovalAudit`             | `by_signalId_and_approvedAt`                 | `signalId`, `approvedAt`                  |
| `supportApprovalAudit`             | `by_approvedAt`                              | `approvedAt`                              |
| `supportApprovalAudit`             | `by_approvedBy_and_approvedAt`               | `approvedBy`, `approvedAt`                |
| `supportMessageAcknowledgements`   | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `supportMessageAcknowledgements`   | `by_location_contact_createdAt`              | `locationId`, `contactId`, `createdAt`    |
| `supportMessageAcknowledgements`   | `by_inboundMessageId`                        | `inboundMessageId`                        |
| `clientHealthSnapshots`            | `by_weekOf`                                  | `weekOf`                                  |
| `clientHealthScores`               | `by_contact`                                 | `contactId`                               |
| `clientHealthScores`               | `by_location`                                | `locationId`                              |
| `clientHealthScores`               | `by_location_category`                       | `locationId`, `category`                  |
| `locationNotes`                    | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `onboardingSubmissions`            | `by_submission_id`                           | `submissionId`                            |
| `onboardingSubmissions`            | `by_status`                                  | `status`                                  |
| `onboardingSubmissions`            | `by_company`                                 | `companyName`                             |
| `provisioningJobs`                 | `by_submission`                              | `submissionId`                            |
| `provisioningJobs`                 | `by_status`                                  | `status`                                  |
| `provisioningLogs`                 | `by_job`                                     | `jobId`                                   |
| `provisioningLogs`                 | `by_status`                                  | `status`                                  |
| `partnerReferralLinks`             | `by_clerk_org`                               | `clerkOrgId`                              |
| `partnerReferralLinks`             | `by_dub_link`                                | `dubLinkId`                               |
| `partnerOrganizations`             | `by_clerk_org`                               | `clerkOrgId`                              |
| `partnerOrganizations`             | `by_slug`                                    | `slug`                                    |
| `partnerOrganizations`             | `by_location`                                | `locationId`                              |
| `applicantCreationLocks`           | `by_contact_pipeline`                        | `locationId`, `contactId`, `pipelineId`   |
| `outreachCallLocks`                | `by_partner`                                 | `partnerId`                               |
| `leadEvents`                       | `by_location`                                | `locationId`                              |
| `leadEvents`                       | `by_contact_location`                        | `contactId`, `locationId`                 |
| `leadEvents`                       | `by_contact_location_createdAt`              | `contactId`, `locationId`, `createdAt`    |
| `leadEvents`                       | `by_status_createdAt`                        | `status`, `createdAt`                     |
| `leadEvents`                       | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `clientHealthAlerts`               | `by_location`                                | `locationId`                              |
| `clientHealthAlerts`               | `by_contact`                                 | `contactId`                               |
| `clientHealthAlerts`               | `by_location_status`                         | `locationId`, `status`                    |
| `processingTeam`                   | `by_userId`                                  | `userId`                                  |
| `processingTeam`                   | `by_email`                                   | `email`                                   |
| `processingTeam`                   | `by_active`                                  | `isActive`                                |
| `processingConfig`                 | `by_key`                                     | `key`                                     |
| `impersonationLog`                 | `by_locationId`                              | `locationId`                              |
| `impersonationLog`                 | `by_contactId`                               | `contactId`                               |
| `impersonationLog`                 | `by_operatorEmail`                           | `operatorEmail`                           |
| `webhookEvents`                    | `by_processed`                               | `processed`                               |
| `webhookEvents`                    | `by_repo`                                    | `repo`                                    |
| `webhookEvents`                    | `by_receivedAt`                              | `receivedAt`                              |
| `migrationMapping`                 | `by_locationId`                              | `locationId`                              |
| `migrationMapping`                 | `by_status`                                  | `status`                                  |
| `migrationMapping`                 | `by_email`                                   | `clientEmail`                             |
| `autoCreditPullEvents`             | `by_decided_at`                              | `decidedAt`                               |
| `autoCreditPullEvents`             | `by_location`                                | `locationId`, `decidedAt`                 |
| `autoCreditPullEvents`             | `by_outcome`                                 | `outcome`, `decidedAt`                    |
| `autoCreditPullEvents`             | `by_contact`                                 | `contactId`, `decidedAt`                  |
| `autoCreditPullEvents`             | `by_contact_location`                        | `contactId`, `locationId`, `decidedAt`    |
| `prospectingCampaigns`             | `by_slug`                                    | `slug`                                    |
| `prospectingCampaigns`             | `by_status`                                  | `status`                                  |
| `prospectingCampaigns`             | `by_createdAt`                               | `createdAt`                               |
| `prospectingPartners`              | `by_clerkUserId`                             | `clerkUserId`                             |
| `prospectingPartners`              | `by_userId`                                  | `userId`                                  |
| `prospectingPartners`              | `by_ghlLocationId`                           | `ghlLocationId`                           |
| `prospectingPartners`              | `by_stripeCustomerId`                        | `stripeCustomerId`                        |
| `prospectingPartners`              | `by_stripeCheckoutSessionId`                 | `stripeCheckoutSessionId`                 |
| `prospectingPartners`              | `by_status`                                  | `status`                                  |
| `prospectingPartners`              | `by_email`                                   | `contactEmail`                            |
| `prospectingPartners`              | `by_createdAt`                               | `createdAt`                               |
| `prospectingPartners`              | `by_outreachTeam`                            | `outreachTeamId`                          |
| `prospectingPartners`              | `by_outreachTeam_verified`                   | `outreachTeamId`, `outreachVerifiedAt`    |
| `prospectingPartners`              | `by_status_createdAt`                        | `status`, `createdAt`                     |
| `prospectingOutreachTeams`         | `by_slug`                                    | `slug`                                    |
| `prospectingOutreachTeams`         | `by_ghlLocationId`                           | `ghlLocationId`                           |
| `prospectingOutreachTeams`         | `by_status`                                  | `status`                                  |
| `prospectingActivity`              | `by_partner_at`                              | `partnerId`, `at`                         |
| `prospectingActivity`              | `by_campaign_at`                             | `campaignId`, `at`                        |
| `prospectingActivity`              | `by_lead_at`                                 | `leadId`, `at`                            |
| `prospectingActivity`              | `by_at`                                      | `at`                                      |
| `prospectingAiReplyControls`       | `by_contact`                                 | `partnerId`, `ghlContactId`               |
| `prospectingAiReplyControls`       | `by_campaign`                                | `campaignId`                              |
| `prospectingAiReplyControls`       | `by_partner_updatedAt`                       | `partnerId`, `updatedAt`                  |
| `prospectingAiReplyDrafts`         | `by_lead_updatedAt`                          | `leadId`, `updatedAt`                     |
| `prospectingAiReplyDrafts`         | `by_status_updatedAt`                        | `status`, `updatedAt`                     |
| `prospectingAiReplyDrafts`         | `by_contact_updatedAt`                       | `partnerId`, `ghlContactId`, `updatedAt`  |
| `prospectingAiReplyDrafts`         | `by_campaign_updatedAt`                      | `campaignId`, `updatedAt`                 |
| `prospectingAiReplyDrafts`         | `by_inboundMessageId`                        | `inboundMessageId`                        |
| `prospectingLeads`                 | `by_partner_received`                        | `partnerId`, `receivedAt`                 |
| `prospectingLeads`                 | `by_partner_ghlContact_received`             | `partnerId`, `ghlContactId`, `receivedAt` |
| `prospectingLeads`                 | `by_partner_status_received`                 | `partnerId`, `status`, `receivedAt`       |
| `prospectingLeads`                 | `by_status`                                  | `status`, `receivedAt`                    |
| `prospectingLeads`                 | `by_campaign_received`                       | `campaignId`, `receivedAt`                |
| `prospectingLeads`                 | `by_receivedAt`                              | `receivedAt`                              |
| `prospectingDeliveryLog`           | `by_lead_at`                                 | `leadId`, `at`                            |
| `prospectingDeliveryLog`           | `by_partner_at`                              | `partnerId`, `at`                         |
| `prospectingDeliveryLog`           | `by_at`                                      | `at`                                      |
| `prospectingAllocations`           | `by_partner_month`                           | `partnerId`, `month`                      |
| `prospectingAllocations`           | `by_month`                                   | `month`                                   |
| `prospectingCoupons`               | `by_code`                                    | `code`                                    |
| `prospectingCoupons`               | `by_status`                                  | `status`, `createdAt`                     |
| `prospectingVolumeCodes`           | `by_code`                                    | `code`                                    |
| `prospectingVolumeCodes`           | `by_status`                                  | `status`, `createdAt`                     |
| `prospectingVolumeCodes`           | `by_partnerEmail`                            | `partnerEmail`                            |
| `prospectingLeadInvoiceTracking`   | `by_status`                                  | `status`, `updatedAt`                     |
| `prospectingLeadInvoiceTracking`   | `by_partner_updatedAt`                       | `partnerId`, `updatedAt`                  |
| `prospectingLeadInvoiceTracking`   | `by_lead`                                    | `leadId`                                  |
| `prospectingLeadInvoiceTracking`   | `by_invoice`                                 | `ghlInvoiceId`                            |
| `prospectingLeadInvoiceTracking`   | `by_reconciledAt`                            | `reconciledAt`                            |
| `automationLocationConfig`         | `by_locationId`                              | `locationId`                              |
| `automationSettings`               | `by_locationId`                              | `locationId`                              |
| `automationSettings`               | `by_locationId_and_triggerKey`               | `locationId`, `triggerKey`                |
| `automationSends`                  | `by_locationId_and_createdAt`                | `locationId`, `createdAt`                 |
| `automationSends`                  | `by_reportId`                                | `reportId`                                |
| `automationSends`                  | `by_idempotencyKey`                          | `idempotencyKey`                          |
| `automationSends`                  | `by_locationId_and_triggerKey_and_createdAt` | `locationId`, `triggerKey`, `createdAt`   |
| `prospectingReportRuns`            | `by_campaign_runAt`                          | `campaignId`, `runAt`                     |
| `prospectingReportRuns`            | `by_runAt`                                   | `runAt`                                   |

## B. Queries without `.withIndex(...)` (table-scan candidates)

| File:Line                                         | Table                      | Snippet                                                                                                                     |
| ------------------------------------------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `convex/admin.ts:139`                             | `fundingPlans`             | `ctx.db .query("fundingPlans") .collect()`                                                                                  |
| `convex/admin.ts:149`                             | `savedFilters`             | `ctx.db .query("savedFilters") .collect()`                                                                                  |
| `convex/adminDashboard.ts:29`                     | `ghlInstallations`         | `ctx.db.query("ghlInstallations").collect()`                                                                                |
| `convex/adminDashboard.ts:31`                     | `creditReportRequests`     | `ctx.db.query("creditReportRequests").collect()`                                                                            |
| `convex/adminDashboard.ts:33`                     | `underwritingResults`      | `ctx.db.query("underwritingResults").collect()`                                                                             |
| `convex/adminDashboard.ts:35`                     | `ghlSubscriptions`         | `ctx.db.query("ghlSubscriptions").collect()`                                                                                |
| `convex/adminDashboard.ts:122`                    | `underwritingResults`      | `ctx.db.query("underwritingResults").collect()`                                                                             |
| `convex/adminDashboard.ts:127`                    | `ghlSubscriptions`         | `ctx.db.query("ghlSubscriptions").collect()`                                                                                |
| `convex/adminDashboard.ts:137`                    | `fundingPlans`             | `ctx.db.query("fundingPlans").collect()`                                                                                    |
| `convex/adminDashboard.ts:141`                    | `ghlInstallations`         | `ctx.db.query("ghlInstallations").collect()`                                                                                |
| `convex/adminDashboard.ts:377`                    | `underwritingResults`      | `ctx.db.query("underwritingResults").collect()`                                                                             |
| `convex/adminDashboard.ts:471`                    | `ghlSubscriptions`         | `ctx.db.query("ghlSubscriptions").collect()`                                                                                |
| `convex/adminDashboard.ts:572`                    | `creditReportRequests`     | `ctx.db.query("creditReportRequests").order("desc").take(limit)`                                                            |
| `convex/adminDashboard.ts:604`                    | `underwritingResults`      | `ctx.db.query("underwritingResults").order("desc").take(limit)`                                                             |
| `convex/adminDashboard.ts:630`                    | `ghlSubscriptions`         | `ctx.db.query("ghlSubscriptions").order("desc").take(limit)`                                                                |
| `convex/adminDashboard.ts:656`                    | `ghlInstallations`         | `ctx.db.query("ghlInstallations").collect()`                                                                                |
| `convex/adminDashboard.ts:782`                    | `ghlInstallations`         | `ctx.db.query("ghlInstallations").collect()`                                                                                |
| `convex/adminInstallations.ts:15`                 | `ghlInstallations`         | `ctx.db .query("ghlInstallations") .take(500)`                                                                              |
| `convex/adminMetrics.ts:90`                       | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(INSTALLATIONS_QUERY_LIMIT)`                                                          |
| `convex/adminMetrics.ts:92`                       | `creditReportRequests`     | `ctx.db.query("creditReportRequests").take(STATS_QUERY_LIMIT)`                                                              |
| `convex/adminMetrics.ts:94`                       | `underwritingResults`      | `ctx.db.query("underwritingResults").take(STATS_QUERY_LIMIT)`                                                               |
| `convex/adminMetrics.ts:96`                       | `fundingPlans`             | `ctx.db.query("fundingPlans").take(STATS_QUERY_LIMIT)`                                                                      |
| `convex/adminMetrics.ts:166`                      | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(INSTALLATIONS_QUERY_LIMIT)`                                                          |
| `convex/adminMetrics.ts:258`                      | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(INSTALLATIONS_QUERY_LIMIT)`                                                          |
| `convex/adminMetrics.ts:269`                      | `ghlSubscriptions`         | `ctx.db.query("ghlSubscriptions").take(STATS_QUERY_LIMIT)`                                                                  |
| `convex/adminMetrics.ts:420`                      | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(INSTALLATIONS_QUERY_LIMIT)`                                                          |
| `convex/adminMetrics.ts:431`                      | `ghlSubscriptions`         | `ctx.db.query("ghlSubscriptions").take(STATS_QUERY_LIMIT)`                                                                  |
| `convex/adminMetrics.ts:875`                      | `creditReportRequests`     | `ctx.db .query("creditReportRequests") .order("desc") .take(limit)`                                                         |
| `convex/adminMetrics.ts:905`                      | `underwritingResults`      | `ctx.db .query("underwritingResults") .order("desc") .take(limit)`                                                          |
| `convex/adminMetrics.ts:1167`                     | `creditReportRequests`     | `ctx.db .query("creditReportRequests") .order("desc") .take(limit)`                                                         |
| `convex/adminMetrics.ts:1196`                     | `underwritingResults`      | `ctx.db .query("underwritingResults") .order("desc") .take(limit)`                                                          |
| `convex/adminMetrics.ts:1257`                     | `ghlInstallations`         | `ctx.db .query("ghlInstallations") .order("desc") .take(INSTALLATIONS_QUERY_LIMIT)`                                         |
| `convex/autoAssign.ts:33`                         | `processingSubmissions`    | `ctx.db .query("processingSubmissions") .filter((q) => q.neq(q.field("assignedToUserId"), undefined)) .take(5000)`          |
| `convex/autoAssign.ts:277`                        | `processingTeam`           | `ctx.db .query("processingTeam") .take(100)`                                                                                |
| `convex/cards.ts:121`                             | `cards`                    | `ctx.db.query("cards").take(500)`                                                                                           |
| `convex/cards.ts:141`                             | `cards`                    | `ctx.db.query("cards").take(500)`                                                                                           |
| `convex/cards.ts:164`                             | `cards`                    | `ctx.db.query("cards").take(500)`                                                                                           |
| `convex/cards.ts:177`                             | `cards`                    | `ctx.db.query("cards").take(500)`                                                                                           |
| `convex/cards.ts:192`                             | `cards`                    | `ctx.db.query("cards").take(500)`                                                                                           |
| `convex/cards.ts:205`                             | `cards`                    | `ctx.db.query("cards").take(500)`                                                                                           |
| `convex/cards.ts:219`                             | `cards`                    | `ctx.db.query("cards").take(500)`                                                                                           |
| `convex/cards.ts:309`                             | `cards`                    | `ctx.db.query("cards").take(500)`                                                                                           |
| `convex/cards.ts:354`                             | `cards`                    | `ctx.db.query("cards").take(500)`                                                                                           |
| `convex/cards.ts:391`                             | `cards`                    | `ctx.db.query("cards").take(500)`                                                                                           |
| `convex/cards.ts:394`                             | `fundingPlans`             | `ctx.db.query("fundingPlans").take(500)`                                                                                    |
| `convex/checkInstallations.ts:9`                  | `ghlInstallations`         | `ctx.db .query("ghlInstallations") .take(INSTALLATIONS_QUERY_LIMIT + 1)`                                                    |
| `convex/fundingPlans.ts:469`                      | `fundingPlans`             | `ctx.db.query("fundingPlans").take(ADMIN_PLAN_QUERY_LIMIT)`                                                                 |
| `convex/fundingPlans.ts:617`                      | `fundingPlans`             | `ctx.db.query("fundingPlans").take(ADMIN_PLAN_QUERY_LIMIT)`                                                                 |
| `convex/fundingPlans.ts:702`                      | `fundingPlans`             | `ctx.db.query("fundingPlans").take(ADMIN_PLAN_QUERY_LIMIT)`                                                                 |
| `convex/fundingPlans.ts:804`                      | `fundingPlans`             | `ctx.db.query("fundingPlans").take(ADMIN_PLAN_QUERY_LIMIT)`                                                                 |
| `convex/fundingPlans.ts:1409`                     | `fundingPlans`             | `ctx.db.query("fundingPlans").take(ADMIN_PLAN_QUERY_LIMIT)`                                                                 |
| `convex/ghlInstallations.ts:307`                  | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(10_000)`                                                                             |
| `convex/globalSearch.ts:115`                      | `processingSubmissions`    | `ctx.db.query("processingSubmissions").order("desc").take(scanLimit)`                                                       |
| `convex/globalSearch.ts:116`                      | `fundingPlans`             | `ctx.db.query("fundingPlans").order("desc").take(scanLimit)`                                                                |
| `convex/globalSearch.ts:117`                      | `operatorInvoices`         | `ctx.db.query("operatorInvoices").order("desc").take(scanLimit)`                                                            |
| `convex/migrations/bulkFixCrmStagesHelpers.ts:15` | `zohoDeals`                | `ctx.db.query("zohoDeals")`                                                                                                 |
| `convex/oneOffMigrations.ts:157`                  | `prospectingPartners`      | `ctx.db .query("prospectingPartners") .paginate({ cursor: args.cursor ?? null, numItems: 200 })`                            |
| `convex/oneOffMigrations.ts:227`                  | `underwritingResults`      | `ctx.db .query("underwritingResults") .paginate({ cursor: args.cursor ?? null, numItems: 500 })`                            |
| `convex/oneOffMigrations.ts:278`                  | `locationSettings`         | `ctx.db .query("locationSettings") .paginate({ cursor: args.cursor ?? null, numItems: 500 })`                               |
| `convex/oneOffMigrations.ts:495`                  | `prospectingPartners`      | `ctx.db .query("prospectingPartners") .paginate({ cursor: args.cursor, numItems: SEED_PAGE_SIZE })`                         |
| `convex/partnerReferralLinks.ts:23`               | `partnerReferralLinks`     | `ctx.db .query("partnerReferralLinks") .filter((q) => q.eq(q.field("status"), "active")) .take(500)`                        |
| `convex/processingFees.ts:146`                    | `processingFees`           | `ctx.db.query("processingFees").collect()`                                                                                  |
| `convex/processingFees.ts:183`                    | `processingFees`           | `ctx.db.query("processingFees").collect()`                                                                                  |
| `convex/processingSubmissions.ts:101`             | `processingSubmissions`    | `ctx.db .query("processingSubmissions") .filter((q) => q.eq(q.field("contactId"), args.contactId)) .order("desc") .take(1)` |
| `convex/processingSubmissions.ts:242`             | `processingSubmissions`    | `ctx.db .query("processingSubmissions") .take(1000)`                                                                        |
| `convex/processingSubmissions.ts:390`             | `processingSubmissions`    | `ctx.db .query("processingSubmissions") .take(1000)`                                                                        |
| `convex/processingSubmissions.ts:1278`            | `processingSubmissions`    | `ctx.db .query("processingSubmissions") .paginate(args.paginationOpts)`                                                     |
| `convex/processingSubmissions.ts:1397`            | `processingSubmissions`    | `ctx.db .query("processingSubmissions") .paginate(args.paginationOpts)`                                                     |
| `convex/processingSubmissions.ts:1523`            | `processingSubmissions`    | `ctx.db .query("processingSubmissions") .paginate(args.paginationOpts)`                                                     |
| `convex/prospecting/outreachTeamsAdmin.ts:96`     | `prospectingOutreachTeams` | `ctx.db.query("prospectingOutreachTeams").take(100)`                                                                        |
| `convex/provisioning.ts:382`                      | `provisioningJobs`         | `ctx.db.query("provisioningJobs").collect()`                                                                                |
| `convex/provisioning.ts:407`                      | `onboardingSubmissions`    | `ctx.db .query("onboardingSubmissions") .collect()`                                                                         |
| `convex/provisioning.ts:430`                      | `provisioningJobs`         | `ctx.db.query("provisioningJobs").collect()`                                                                                |
| `convex/salesCommissions.ts:285`                  | `salesCommissions`         | `ctx.db .query("salesCommissions") .order("desc") .take(limit)`                                                             |
| `convex/stitchCreditTokens.ts:15`                 | `stitchCreditTokens`       | `ctx.db .query("stitchCreditTokens") .order("desc") .first()`                                                               |
| `convex/stitchCreditTokens.ts:45`                 | `stitchCreditTokens`       | `ctx.db .query("stitchCreditTokens") .order("desc") .first()`                                                               |
| `convex/underwriting.ts:1950`                     | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(100)`                                                                                |
| `convex/underwriting.ts:3390`                     | `underwritingResults`      | `ctx.db.query("underwritingResults").take(8000)`                                                                            |
| `convex/zohoSync.ts:1056`                         | `zohoCreditReports`        | `ctx.db.query("zohoCreditReports").collect()`                                                                               |
| `convex/zohoVerticalAccounts.ts:113`              | `zohoVerticalAccounts`     | `ctx.db .query("zohoVerticalAccounts") .order("desc") .take(limit)`                                                         |

> Note: a `query()` without `.withIndex(...)` is not always a bug — it may be intentionally fetching a single doc by id or operating on a tiny table (`get`, `unique`, `first`, etc.). Treat this list as a triage queue, not a defect list.

## C. Unbounded `.collect()` locations

"Unbounded" = a `.collect()` with **no** preceding `.withIndex(...)` and **no** `.take(N)` in the same chain. These walk the entire table.

| File:Line                           | Snippet                                          |
| ----------------------------------- | ------------------------------------------------ |
| `convex/admin.ts:141`               | `.query("fundingPlans") .collect()`              |
| `convex/admin.ts:151`               | `.query("savedFilters") .collect()`              |
| `convex/adminDashboard.ts:29`       | `ctx.db.query("ghlInstallations").collect()`     |
| `convex/adminDashboard.ts:31`       | `ctx.db.query("creditReportRequests").collect()` |
| `convex/adminDashboard.ts:33`       | `ctx.db.query("underwritingResults").collect()`  |
| `convex/adminDashboard.ts:35`       | `ctx.db.query("ghlSubscriptions").collect()`     |
| `convex/adminDashboard.ts:122`      | `ctx.db.query("underwritingResults").collect()`  |
| `convex/adminDashboard.ts:127`      | `ctx.db.query("ghlSubscriptions").collect()`     |
| `convex/adminDashboard.ts:137`      | `ctx.db.query("fundingPlans").collect()`         |
| `convex/adminDashboard.ts:141`      | `ctx.db.query("ghlInstallations").collect()`     |
| `convex/adminDashboard.ts:377`      | `ctx.db.query("underwritingResults").collect()`  |
| `convex/adminDashboard.ts:471`      | `ctx.db.query("ghlSubscriptions").collect()`     |
| `convex/adminDashboard.ts:656`      | `ctx.db.query("ghlInstallations").collect()`     |
| `convex/adminDashboard.ts:782`      | `ctx.db.query("ghlInstallations").collect()`     |
| `convex/migrations.ts:395`          | `await query.collect()`                          |
| `convex/processingFees.ts:96`       | `await feesQuery.collect()`                      |
| `convex/processingFees.ts:146`      | `ctx.db.query("processingFees").collect()`       |
| `convex/processingFees.ts:183`      | `ctx.db.query("processingFees").collect()`       |
| `convex/provisioning.ts:382`        | `ctx.db.query("provisioningJobs").collect()`     |
| `convex/provisioning.ts:409`        | `.query("onboardingSubmissions") .collect()`     |
| `convex/provisioning.ts:430`        | `ctx.db.query("provisioningJobs").collect()`     |
| `convex/termLoanSubmissions.ts:660` | `return submissionsQuery.collect()`              |
| `convex/zohoSync.ts:1056`           | `ctx.db.query("zohoCreditReports").collect()`    |

> Note: unbounded `.collect()` is flagged by the pre-commit Convex linter as a blocking error. Each entry above should ideally be replaced with `.take(N)` (or paginated). Some may be safe because the underlying table is provably small (e.g. one row per location); confirm before changing behavior.

***

Re-run with `bun run scripts/audit-convex-indexes.ts`. The JSON sidecar at the same path is available for follow-up tooling (e.g. piping into Linear, an annotated diff, or a custom reporter).
