The Ecto tab (ADR 08): every query of the page,
oldest first, with SQL, params, timings, rows and the code that ran it, N+1
groups flagged above them, EXPLAIN for SELECTs and a JSON export. Part of
:defaults.
config :phoenix_dev_toolbar, repos: [MyApp.Repo]Options
| Option | Type | Default |
|---|---|---|
repos: | list of repo modules | the top level repos config, else the :ecto_repos of the loaded applications |
n_plus_one: | integer >= 2, or false to turn the detector off | 5 |
caller_modules: | list of regexes (matched against the module name) or module name prefixes: where a query's caller is | a *Web namespace, a *Live or *Controller module |
repos: in the plugin entry wins over the top level config:
config :phoenix_dev_toolbar,
plugins: [:defaults, {PhoenixDevToolbar.Plugins.Ecto, repos: [MyApp.Repo], n_plus_one: 3}]With no repos found, the tab stays empty and one warning names the config line.
Set stacktrace: true in the repo's config to see where each query comes from.
Each query then has an origin (the Repo call site) and a caller: the
first frame of a module matching caller_modules: or of a LiveView callback
(mount/3, handle_event/3, on_mount/4, ...), else the frame after the
origin. Phoenix.Ecto.CheckRepoStatus queries (schema_migrations) are
tagged as framework noise and left out of the counts.
ecto_sql is an optional dependency: without it this plugin attaches to nothing.