Open Bouke opened 1 year ago
Do you have an example query? Inline is not the default because it may even mess up a few more complicated queries (you simply can't do everything in-line that could be a parameter, it's a different superset). How big of a SQL string are we talking here? We can definitely look at optimizing, just hasn't come up before with numbers being that small and usage being relatively rare.
I can confirm this. 582035 character in my pgsql query (lots of arguments) takes 90s without options.SqlFormatter = null instead of 5 seconds with it
I was debugging a performance issue with some bulk operation. On a hunch I turned off MiniProfiler and the performance difference was night and day. The total time spent in the operation dropped from 102 to 13 seconds, with ~6 seconds spend on the 19 sql operations (consisting of many insert/update).
After doing some profiling I found that all of MiniProfiler's time was spent in InlineFormatter:
I turned the formatting (mostly) off by setting
options.SqlFormatter = null
. Now I still get sql timings, but without all the work related to the formatting. I'm using MiniProfiler here in a command line utility and am only interested in the timings and not even looking at (un)formatted sql.MiniProfiler.EntityFrameworkCore: 4.2.22