2 ms·
> As part of the build process it should examine your usage and put indexes in the column that you're using in find/findMany This is not as easy as it sounds,
by selcuka 4y ago
> As part of the build process it should examine your usage and put indexes in the column that you're using in find/findMany
This is not as easy as it sounds, though. Reliably inspecting source code is hard, and definitely not in the scope of an ORM. It also can't catch dynamically generated queries (think user configurable filters). It might be a good idea for a third party product that analyses your code and suggest adding indexes to models.
You know who knows best about your queries? It's the RDBMS. There are tools that can add/suggest indexes by searching your database logs for slow running queries.