Accumulates repeated SELECT shapes per Proces or unit of work (LiveView mount/params/event, HTTP request, Oban job) for N+1 detection.
check/1 counts query shapes in one process-dictionary entry; flush/0 returns the counts and clears them. The host app attaches telemetry span-stop handlers that flush at the end of each unit of work and report offenders in one consolidated warning (see example implementation in priv/sample_telemetry.ex), so counts can never leak across user actions, and no state lingers in idle/hibernated processes.
Local pdict only as parallel preload Tasks are not N+1 loops, so nothing is read from or written to ancestor processes.
Disabled unless config :ecto_sparkles, :n_plus_1_detect, true is enabled.
Summary
Functions
Accumulate one occurrence of a query shape (SELECTs only; no-op unless enabled).
Returns the accumulated %{query => count} and clears the state (call at the end of a unit of work).