Very cool idea suggested by @lauxjpn: we now have ToQueryString, we could also get the query plan from the database.
SQL Server:
SET SHOWPLAN_ALL ON;
<query>
SET SHOWPLAN_ALL OFF;
PostgreSQL / SQLite
EXPLAIN <query>
When this has been implemented, this basically screams for an extension, that allows users to specify execution duration limits, that will log the query together with the query plan, once those limits get hit.
We may as well just find out what's wrong with the queries and fix it too :rofl:
Seriously, this is a really nice direction.
This has challenges that ToQueryString doesn't have--most notably that it requires a connection to the database to run the "explain" query. So this probably needs a bit more thought, but integrating this in some way with EF Core would be very useful.
Also not all users have showplan rights with SQL Server..
Most helpful comment
Also not all users have showplan rights with SQL Server..