A namespace of useful functions for inspecting PostgreSQL databases in Clojure.
The SQL query logic is based on
Queries ported to HugSQL syntax to access them as Clojure data structures.
A namespace of useful functions for inspecting PostgreSQL databases in Clojure. The SQL query logic is based on * https://github.com/heroku/heroku-pg-extras/tree/main * https://github.com/pawurb/ecto_psql_extras/tree/main * https://github.com/rustprooflabs/pgdd Queries ported to HugSQL syntax to access them as Clojure data structures.
Defines the critical queries and their cutoffs for the diagnose
function. The value is a map containing a predicate fn (true = pass)
to test against each result, and a description of the problem if false.
Defines the critical queries and their cutoffs for the `diagnose` function. The value is a map containing a predicate fn (true = pass) to test against each result, and a description of the problem if false.
(diagnose stats
&
{:keys [diagnostic-fns] :or {diagnostic-fns default-diagnostic-fns}})
Run assertions on stats and return a seq of result maps. Iterate through the diagnostic functions, run them, then iterate through each record, applying the predicate. Returns a flat list of result maps.
Run assertions on stats and return a seq of result maps. Iterate through the diagnostic functions, run them, then iterate through each record, applying the predicate. Returns a flat list of result maps.
(diagnose-warnings stats
&
{:keys [diagnostic-fns]
:or {diagnostic-fns default-diagnostic-fns}})
Run assertions on stats and return a seq of result maps. Iterate through the diagnostic functions, then through the results, applying the predicate. Returns a flat list of result maps, filtered to contain only actionable warnings. An empty return sequence indicates all your dianostics passed.
Run assertions on stats and return a seq of result maps. Iterate through the diagnostic functions, then through the results, applying the predicate. Returns a flat list of result maps, filtered to contain only actionable warnings. An empty return sequence indicates all your dianostics passed.
(read-data-dictionary db)
Create a data dictionary summarizing all major objects in your PostgreSQL database. Respects SQL COMMMENTS, thus serves as a human-readable description of your data model.
Create a data dictionary summarizing all major objects in your PostgreSQL database. Respects SQL COMMMENTS, thus serves as a human-readable description of your data model.
(read-stats db & {:keys [limit] :or {limit 10}})
Query postgres instance for all available diagnostic information. This will invoke all of the public, read-only diagnostic queries in the namespace.
The :outliers and :calls stats require enabling the pg-stat-statements extension, otherwise they will log a warning and return nil.
Query postgres instance for all available diagnostic information. This will invoke all of the public, read-only diagnostic queries in the namespace. The :outliers and :calls stats require enabling the pg-stat-statements extension, otherwise they will log a warning and return nil.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close