> ## 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 06 06

# 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-06-06T00:46:52.298Z`
* **Schema source:** `convex/schema.ts`
* **Convex files scanned:** 235
* **Tables declared:** 109 (with 342 total indexes)
* **Tables with zero indexes:** 1
* **Queries:** 1022 total — 944 use `.withIndex(...)`, 78 look like table scans
* **Missing index references:** 0
* **`.collect()` calls:** 74 total — 74 bounded (scoped by `.withIndex(...)` or capped by `.take(N)`), 0 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_contact_location_createdAt`              | `contactId`, `locationId`, `createdAt`    |
| `creditReportRequests`               | `by_company`                                 | `companyId`                               |
| `creditReportRequests`               | `by_location`                                | `locationId`                              |
| `creditReportRequests`               | `by_createdAt`                               | `createdAt`                               |
| `creditReportRequests`               | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `creditReportRequestBlobs`           | `by_request`                                 | `requestId`                               |
| `creditReportRequestBlobs`           | `by_creditReport`                            | `creditReportId`                          |
| `stitchCreditTokens`                 | *(no indexes)*                               | —                                         |
| `underwritingResults`                | `by_report`                                  | `reportId`                                |
| `underwritingResults`                | `by_report_createdAt`                        | `reportId`, `createdAt`                   |
| `underwritingResults`                | `by_contact`                                 | `contactId`                               |
| `underwritingResults`                | `by_contact_location_createdAt`              | `contactId`, `locationId`, `createdAt`    |
| `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_contact_location_createdAt`              | `contactId`, `locationId`, `createdAt`    |
| `fundingPlans`                       | `by_createdAt`                               | `createdAt`                               |
| `fundingPlans`                       | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `adminMetricsDaily`                  | `by_metricType_dayBucket`                    | `metricType`, `dayBucket`                 |
| `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_syncedAt`                                | `syncedAt`                                |
| `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_location_pipeline`                       | `locationId`, `pipelineType`              |
| `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`                    |
| `processingFees`                     | `by_createdAt`                               | `createdAt`                               |
| `processingFees`                     | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `processingFees`                     | `by_location_status_createdAt`               | `locationId`, `status`, `createdAt`       |
| `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`                 |
| `operatorInvoices`                   | `by_sourceClientInvoiceId`                   | `sourceClientInvoiceId`                   |
| `operatorInvoices`                   | `by_mfmInvoiceId`                            | `mfmInvoiceId`                            |
| `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`                             |
| `onboardingSubmissions`              | `by_createdAt`                               | `createdAt`                               |
| `provisioningJobs`                   | `by_submission`                              | `submissionId`                            |
| `provisioningJobs`                   | `by_status`                                  | `status`                                  |
| `provisioningJobs`                   | `by_createdAt`                               | `createdAt`                               |
| `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`                               |
| `outreachShortLinks`                 | `by_partner_template`                        | `partnerId`, `template`                   |
| `outreachShortLinks`                 | `by_slug`                                    | `slug`                                    |
| `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_partner_kind_at`                         | `partnerId`, `kind`, `at`                 |
| `prospectingActivity`                | `by_campaign_at`                             | `campaignId`, `at`                        |
| `prospectingActivity`                | `by_lead_at`                                 | `leadId`, `at`                            |
| `prospectingActivity`                | `by_lead_kind_at`                            | `leadId`, `kind`, `at`                    |
| `prospectingActivity`                | `by_at`                                      | `at`                                      |
| `prospectingOutreachMessageReceipts` | `by_messageId`                               | `messageId`                               |
| `prospectingOutreachMessageReceipts` | `by_lead_createdAt`                          | `leadId`, `createdAt`                     |
| `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_outreachTeamGhlContactId`                | `outreachTeamGhlContactId`                |
| `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_partner_kind_at`                         | `partnerId`, `kind`, `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`   |
| `businessQuestionnaires`             | `by_contact`                                 | `contactId`, `locationId`                 |
| `prospectingReportRuns`              | `by_campaign_runAt`                          | `campaignId`, `runAt`                     |
| `prospectingReportRuns`              | `by_runAt`                                   | `runAt`                                   |
| `analyticsReports`                   | `by_location`                                | `locationId`                              |
| `analyticsReports`                   | `by_location_dataSource`                     | `locationId`, `dataSource`                |
| `analyticsScheduledReports`          | `by_enabled_nextRunAt`                       | `enabled`, `nextRunAt`                    |
| `analyticsScheduledReports`          | `by_location`                                | `locationId`                              |
| `analyticsScheduledReports`          | `by_report`                                  | `reportId`                                |
| `analyticsReportFiles`               | `by_expiresAt`                               | `expiresAt`                               |
| `analyticsReportFiles`               | `by_location`                                | `locationId`                              |
| `dataAccessSettings`                 | `by_location`                                | `locationId`                              |
| `crmUserScopeCache`                  | `by_location_user`                           | `locationId`, `userId`                    |
| `crmUserScopeCache`                  | `by_location`                                | `locationId`                              |
| `underwritingReviewLabels`           | `by_requestId_createdAt`                     | `requestId`, `createdAt`                  |
| `underwritingReviewLabels`           | `by_createdAt`                               | `createdAt`                               |
| `underwritingReviewLabels`           | `by_verdict_createdAt`                       | `verdict`, `createdAt`                    |
| `underwritingReviewLabels`           | `by_location_createdAt`                      | `locationId`, `createdAt`                 |
| `underwritingCalibrationProposals`   | `by_createdAt`                               | `createdAt`                               |
| `underwritingCalibrationProposals`   | `by_status_createdAt`                        | `status`, `createdAt`                     |
| `underwritingReviewFlags`            | `by_status_createdAt`                        | `status`, `createdAt`                     |
| `underwritingReviewFlags`            | `by_requestId`                               | `requestId`                               |
| `underwritingReviewFlags`            | `by_category_status`                         | `category`, `status`                      |

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

| File:Line                                                   | Table                      | Snippet                                                                                                                         |
| ----------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `convex/admin/revertAutoApplicantPromotion.ts:102`          | `prospectingLeads`         | `ctx.db .query("prospectingLeads") .order("desc") .paginate({ cursor, numItems: PAGE })`                                        |
| `convex/adminDashboard.ts:51`                               | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(GLOBAL_REFERENCE_SCAN_CAP)`                                                              |
| `convex/adminDashboard.ts:52`                               | `creditReportRequests`     | `ctx.db.query("creditReportRequests").take(GLOBAL_AGGREGATE_CAP)`                                                               |
| `convex/adminDashboard.ts:53`                               | `underwritingResults`      | `ctx.db.query("underwritingResults").take(GLOBAL_AGGREGATE_CAP)`                                                                |
| `convex/adminDashboard.ts:54`                               | `ghlSubscriptions`         | `ctx.db.query("ghlSubscriptions").take(GLOBAL_AGGREGATE_CAP)`                                                                   |
| `convex/adminDashboard.ts:157`                              | `ghlSubscriptions`         | `ctx.db.query("ghlSubscriptions").take(GLOBAL_AGGREGATE_CAP)`                                                                   |
| `convex/adminDashboard.ts:172`                              | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(GLOBAL_REFERENCE_SCAN_CAP)`                                                              |
| `convex/adminDashboard.ts:501`                              | `ghlSubscriptions`         | `ctx.db.query("ghlSubscriptions").take(GLOBAL_AGGREGATE_CAP)`                                                                   |
| `convex/adminDashboard.ts:602`                              | `creditReportRequests`     | `ctx.db.query("creditReportRequests").order("desc").take(limit)`                                                                |
| `convex/adminDashboard.ts:625`                              | `underwritingResults`      | `ctx.db.query("underwritingResults").order("desc").take(limit)`                                                                 |
| `convex/adminDashboard.ts:651`                              | `ghlSubscriptions`         | `ctx.db.query("ghlSubscriptions").order("desc").take(limit)`                                                                    |
| `convex/adminDashboard.ts:677`                              | `ghlInstallations`         | `ctx.db .query("ghlInstallations") .take(GLOBAL_REFERENCE_SCAN_CAP)`                                                            |
| `convex/adminDashboard.ts:806`                              | `ghlInstallations`         | `ctx.db .query("ghlInstallations") .take(GLOBAL_REFERENCE_SCAN_CAP)`                                                            |
| `convex/adminInstallations.ts:15`                           | `ghlInstallations`         | `ctx.db .query("ghlInstallations") .take(500)`                                                                                  |
| `convex/adminMetrics.ts:96`                                 | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(INSTALLATIONS_QUERY_LIMIT)`                                                              |
| `convex/adminMetrics.ts:98`                                 | `creditReportRequests`     | `ctx.db.query("creditReportRequests").take(STATS_QUERY_LIMIT)`                                                                  |
| `convex/adminMetrics.ts:100`                                | `underwritingResults`      | `ctx.db.query("underwritingResults").take(STATS_QUERY_LIMIT)`                                                                   |
| `convex/adminMetrics.ts:102`                                | `fundingPlans`             | `ctx.db.query("fundingPlans").take(STATS_QUERY_LIMIT)`                                                                          |
| `convex/adminMetrics.ts:172`                                | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(INSTALLATIONS_QUERY_LIMIT)`                                                              |
| `convex/adminMetrics.ts:264`                                | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(INSTALLATIONS_QUERY_LIMIT)`                                                              |
| `convex/adminMetrics.ts:275`                                | `ghlSubscriptions`         | `ctx.db.query("ghlSubscriptions").take(STATS_QUERY_LIMIT)`                                                                      |
| `convex/adminMetrics.ts:434`                                | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(INSTALLATIONS_QUERY_LIMIT)`                                                              |
| `convex/adminMetrics.ts:743`                                | `creditReportRequests`     | `ctx.db .query("creditReportRequests") .order("desc") .take(limit)`                                                             |
| `convex/adminMetrics.ts:773`                                | `underwritingResults`      | `ctx.db .query("underwritingResults") .order("desc") .take(limit)`                                                              |
| `convex/adminMetrics.ts:1035`                               | `creditReportRequests`     | `ctx.db .query("creditReportRequests") .order("desc") .take(limit)`                                                             |
| `convex/adminMetrics.ts:1064`                               | `underwritingResults`      | `ctx.db .query("underwritingResults") .order("desc") .take(limit)`                                                              |
| `convex/adminMetrics.ts:1125`                               | `ghlInstallations`         | `ctx.db .query("ghlInstallations") .order("desc") .take(INSTALLATIONS_QUERY_LIMIT)`                                             |
| `convex/adminMetricsReads.ts:674`                           | `ghlSubscriptions`         | `ctx.db .query("ghlSubscriptions") .take(SOURCE_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:540`                                | `fundingPlans`             | `ctx.db.query("fundingPlans").take(ADMIN_PLAN_QUERY_LIMIT)`                                                                     |
| `convex/fundingPlans.ts:688`                                | `fundingPlans`             | `ctx.db.query("fundingPlans").take(ADMIN_PLAN_QUERY_LIMIT)`                                                                     |
| `convex/fundingPlans.ts:773`                                | `fundingPlans`             | `ctx.db.query("fundingPlans").take(ADMIN_PLAN_QUERY_LIMIT)`                                                                     |
| `convex/fundingPlans.ts:875`                                | `fundingPlans`             | `ctx.db.query("fundingPlans").take(ADMIN_PLAN_QUERY_LIMIT)`                                                                     |
| `convex/fundingPlans.ts:1480`                               | `fundingPlans`             | `ctx.db.query("fundingPlans").take(ADMIN_PLAN_QUERY_LIMIT)`                                                                     |
| `convex/ghlInstallations.ts:294`                            | `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.ts:1476`                                 | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(scanLimit)`                                                                              |
| `convex/migrations/2026_05_18_provision_short_links.ts:98`  | `prospectingPartners`      | `ctx.db .query("prospectingPartners") .take(PARTNER_SCAN_CAP)`                                                                  |
| `convex/migrations/2026_05_18_provision_short_links.ts:137` | `prospectingPartners`      | `ctx.db .query("prospectingPartners") .take(PARTNER_SCAN_CAP)`                                                                  |
| `convex/migrations/bulkFixCrmStagesHelpers.ts:15`           | `zohoDeals`                | `ctx.db.query("zohoDeals")`                                                                                                     |
| `convex/oneOffMigrations.ts:74`                             | `creditReportRequests`     | `ctx.db .query("creditReportRequests") .paginate({ cursor: args.cursor ?? null, numItems: batchSize })`                         |
| `convex/oneOffMigrations.ts:140`                            | `creditReportRequests`     | `ctx.db .query("creditReportRequests") .paginate({ cursor: args.cursor ?? null, numItems: batchSize })`                         |
| `convex/oneOffMigrations.ts:310`                            | `prospectingPartners`      | `ctx.db .query("prospectingPartners") .paginate({ cursor: args.cursor ?? null, numItems: 200 })`                                |
| `convex/oneOffMigrations.ts:383`                            | `underwritingResults`      | `ctx.db .query("underwritingResults") .paginate({ cursor: args.cursor ?? null, numItems: 500 })`                                |
| `convex/oneOffMigrations.ts:474`                            | `prospectingPartners`      | `ctx.db .query("prospectingPartners") .paginate({ cursor: args.cursor, numItems: SEED_PAGE_SIZE })`                             |
| `convex/oneOffMigrations.ts:1539`                           | `prospectingPartners`      | `ctx.db .query("prospectingPartners") .paginate({ cursor, numItems: CAMPAIGN_DELETE_PAGE_SIZE, })`                              |
| `convex/oneOffMigrations.ts:1675`                           | `prospectingPartners`      | `ctx.db .query("prospectingPartners") .paginate({ cursor: args.cursor, numItems: Math.max(1, Math.min(args.numItems, 100)), })` |
| `convex/partnerReferralLinks.ts:23`                         | `partnerReferralLinks`     | `ctx.db .query("partnerReferralLinks") .filter((q) => q.eq(q.field("status"), "active")) .take(500)`                            |
| `convex/processingFees.ts:152`                              | `processingFees`           | `ctx.db .query("processingFees") .order("desc") .take(PROCESSING_FEE_SCAN_CAP)`                                                 |
| `convex/processingFees.ts:184`                              | `processingFees`           | `ctx.db .query("processingFees") .order("desc") .take(PROCESSING_FEE_SCAN_CAP)`                                                 |
| `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:101`              | `prospectingOutreachTeams` | `ctx.db.query("prospectingOutreachTeams").take(100)`                                                                            |
| `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:1060`                               | `ghlInstallations`         | `ctx.db.query("ghlInstallations").take(100)`                                                                                    |
| `convex/underwriting.ts:2517`                               | `underwritingResults`      | `ctx.db.query("underwritingResults").take(8000)`                                                                                |
| `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. Missing table-scoped index references

Each `.withIndex("name")` below is checked against the indexes declared on that exact `ctx.db.query("table")` table.

*None detected.*

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

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

*None detected.*

***

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).
