> ## Documentation Index
> Fetch the complete documentation index at: https://vlyai-1c28d863.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Performance issues

> Slow queries, slow page loads, slow agent responses. Diagnosis and fixes.

Common performance issues and where to fix.

## Slow Convex queries

<AccordionGroup>
  <Accordion title="Query takes >1s" icon="alert-triangle">
    Almost always: missing index. The query is using `.filter()` instead of `.withIndex()`. Add an appropriate index to the schema; re-prompt or hand-edit the query to use it.
  </Accordion>

  <Accordion title="`.collect()` returning huge arrays" icon="alert-triangle">
    Replace with `.paginate()` to fetch incrementally. See [Pagination](/architecture/pagination).
  </Accordion>

  <Accordion title="Deep N+1 problem" icon="alert-triangle">
    Joining many related records inside a query. Either denormalize or batch the lookups.
  </Accordion>
</AccordionGroup>

## Slow page loads

<AccordionGroup>
  <Accordion title="Initial load >3s" icon="alert-triangle">
    Bundle too large. Code-split routes, lazy-load heavy components, audit npm dependencies.
  </Accordion>

  <Accordion title="Time to interactive slow" icon="alert-triangle">
    Render-blocking resources or many small fetches. Use Suspense boundaries; combine queries.
  </Accordion>

  <Accordion title="Images slow" icon="alert-triangle">
    Use WebP / AVIF; serve appropriately-sized images; lazy-load below-the-fold.
  </Accordion>
</AccordionGroup>

## Slow agent responses

<AccordionGroup>
  <Accordion title="Build takes >2 min" icon="alert-triangle">
    Large project (1000+ files) or expensive type-check. Sometimes unavoidable; consider modularizing.
  </Accordion>

  <Accordion title="Agent retries multiple times" icon="alert-triangle">
    Type errors require multiple corrections. Often a sign the prompt set up an inconsistent ask. Re-prompt with the resolution.
  </Accordion>
</AccordionGroup>

## Profiling

vly's editor includes a Convex query profiler:

```bash theme={null}
vly convex query-stats --project prj_01...
```

Shows top slow queries, top missed-index queries, and recommendations.

For frontend perf, use Chrome DevTools → Performance tab as usual.

## Related

<CardGroup cols={3}>
  <Card title="Indexes" icon="zap" href="/convex/indexes">
    Make queries fast.
  </Card>

  <Card title="Pagination" icon="list-ordered" href="/architecture/pagination">
    Avoid loading huge arrays.
  </Card>

  <Card title="Caching" icon="archive" href="/architecture/caching">
    For expensive computations.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.