Torus.QueryInspector (Torus v0.2.2)

View Source

Helpers to debug your SQL queries. You can this module both while creating the queries and directly in your running production shell once deployed, so that the explain analyze returns more accurate results.

Summary

Functions

Runs explain analyze on the query and prints it to the console. Returns the query.

Converts the query to SQL and prints it to the console. Returns the query.

Substitutes the parameters in the query and prints the SQL to the console. Returns the query. The SQL is in its raw form and can be directly executed by postgres.

Functions

substituted_sql(query, repo, kind \\ :all)

tap_explain_analyze(query, repo, kind \\ :all)

@spec tap_explain_analyze(Ecto.Query.t(), Ecto.Repo, :all | :update_all | :delete_all) ::
  Ecto.Query.t()

Runs explain analyze on the query and prints it to the console. Returns the query.

Runs the query!

tap_sql(query, repo, kind \\ :all)

@spec tap_sql(Ecto.Query.t(), Ecto.Repo, :all | :update_all | :delete_all) ::
  Ecto.Query.t()

Converts the query to SQL and prints it to the console. Returns the query.

tap_substituted_sql(query, repo, kind \\ :all)

Substitutes the parameters in the query and prints the SQL to the console. Returns the query. The SQL is in its raw form and can be directly executed by postgres.