Liking cljdoc? Tell your friends :D

postgres-extras-clj.core

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.
raw docstring

all-locksclj

(all-locks db)
(all-locks db params)
(all-locks db params options & command-options)

Queries with active locks

Queries with active locks
sourceraw docstring

bloatclj

(bloat db)
(bloat db params)
(bloat db params options & command-options)

Table and index bloat in your database ordered by most wasteful

Table and index bloat in your database ordered by most wasteful
sourceraw docstring

blockingclj

(blocking db)
(blocking db params)
(blocking db params options & command-options)

Queries holding locks other queries are waiting to be released

Queries holding locks other queries are waiting to be released
sourceraw docstring

cache-hitclj

(cache-hit db)
(cache-hit db params)
(cache-hit db params options & command-options)

Index and table hit rate

Index and table hit rate
sourceraw docstring

callsclj

(calls db)
(calls db params)
(calls db params options & command-options)

Queries that have the highest frequency of execution

Queries that have the highest frequency of execution
sourceraw docstring

columnsclj

(columns db)
(columns db params)
(columns db params options & command-options)

List all database column objects

List all database column objects
sourceraw docstring

connectionsclj

(connections db)
(connections db params)
(connections db params options & command-options)

Returns the list of all active database connections

Returns the list of all active database connections
sourceraw docstring

databasesclj

(databases db)
(databases db params)
(databases db params options & command-options)

List all databases

List all databases
sourceraw docstring

db-settingsclj

(db-settings db)
(db-settings db params)
(db-settings db params options & command-options)

Values of selected PostgreSQL settings

Values of selected PostgreSQL settings
sourceraw docstring

default-diagnostic-fnsclj

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.
sourceraw docstring

diagnoseclj

(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.
sourceraw docstring

diagnose-warningsclj

(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.
sourceraw docstring

duplicate-indexesclj

(duplicate-indexes db)
(duplicate-indexes db params)
(duplicate-indexes db params options & command-options)

Multiple indexes that have the same set of columns, same opclass, expression and predicate

Multiple indexes that have the same set of columns, same opclass, expression and predicate
sourceraw docstring

extensionsclj

(extensions db)
(extensions db params)
(extensions db params options & command-options)

Available and installed extensions

Available and installed extensions
sourceraw docstring

functionsclj

(functions db)
(functions db params)
(functions db params options & command-options)

List all function objects in current database

List all function objects in current database
sourceraw docstring

health-checkclj

(health-check db)
(health-check db params)
(health-check db params options & command-options)

Checks the db for liveliness

Checks the db for liveliness
sourceraw docstring

index-cache-hitclj

(index-cache-hit db)
(index-cache-hit db params)
(index-cache-hit db params options & command-options)

Calculates your cache hit rate for reading indexes

Calculates your cache hit rate for reading indexes
sourceraw docstring

index-sizeclj

(index-size db)
(index-size db params)
(index-size db params options & command-options)

The size of indexes, descending by size

The size of indexes, descending by size
sourceraw docstring

index-usageclj

(index-usage db)
(index-usage db params)
(index-usage db params options & command-options)

Index hit rate (effective databases are at 99% and up)

Index hit rate (effective databases are at 99% and up)
sourceraw docstring

indexesclj

(indexes db)
(indexes db params)
(indexes db params options & command-options)

List all index objects in current database

List all index objects in current database
sourceraw docstring

kill-all!clj

(kill-all! db)
(kill-all! db params)
(kill-all! db params options & command-options)

Kill all the active database connections

Kill all the active database connections
sourceraw docstring

locksclj

(locks db)
(locks db params)
(locks db params options & command-options)

Queries with active exclusive locks

Queries with active exclusive locks
sourceraw docstring

long-running-queriesclj

(long-running-queries db)
(long-running-queries db params)
(long-running-queries db params options & command-options)

All queries longer than the threshold by descending duration

All queries longer than the threshold by descending duration
sourceraw docstring

mandelbrotclj

(mandelbrot db)
(mandelbrot db params)
(mandelbrot db params options & command-options)

The mandelbrot set

The mandelbrot set
sourceraw docstring

null-indexesclj

(null-indexes db)
(null-indexes db params)
(null-indexes db params options & command-options)

Find indexes with a high ratio of NULL values

Find indexes with a high ratio of NULL values
sourceraw docstring

outliersclj

(outliers db)
(outliers db params)
(outliers db params options & command-options)

Queries that have longest execution time in aggregate.

Queries that have longest execution time in aggregate.
sourceraw docstring

partition-childrenclj

(partition-children db)
(partition-children db params)
(partition-children db params options & command-options)

List all child partitions in current database

List all child partitions in current database
sourceraw docstring

partition-parentsclj

(partition-parents db)
(partition-parents db params)
(partition-parents db params options & command-options)

List all parent partitions in current database

List all parent partitions in current database
sourceraw docstring

read-data-dictionaryclj

(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.
sourceraw docstring

read-statsclj

(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.
sourceraw docstring

records-rankclj

(records-rank db)
(records-rank db params)
(records-rank db params options & command-options)

All tables and the number of rows in each ordered by number of rows descending

All tables and the number of rows in each ordered by number of rows descending
sourceraw docstring

schemasclj

(schemas db)
(schemas db params)
(schemas db params options & command-options)

List all shemas in current database

List all shemas in current database
sourceraw docstring

seq-scansclj

(seq-scans db)
(seq-scans db params)
(seq-scans db params options & command-options)

Count of sequential scans by table descending by order

Count of sequential scans by table descending by order
sourceraw docstring

table-cache-hitclj

(table-cache-hit db)
(table-cache-hit db params)
(table-cache-hit db params options & command-options)

Calculates your cache hit rate for reading tables

Calculates your cache hit rate for reading tables
sourceraw docstring

table-indexes-sizeclj

(table-indexes-size db)
(table-indexes-size db params)
(table-indexes-size db params options & command-options)

Total size of all the indexes on each table, descending by size

Total size of all the indexes on each table, descending by size
sourceraw docstring

table-sizeclj

(table-size db)
(table-size db params)
(table-size db params options & command-options)

Size of the tables (excluding indexes), descending by size

Size of the tables (excluding indexes), descending by size
sourceraw docstring

tablesclj

(tables db)
(tables db params)
(tables db params options & command-options)

List all table objects in current database

List all table objects in current database
sourceraw docstring

total-index-sizeclj

(total-index-size db)
(total-index-size db params)
(total-index-size db params options & command-options)

Total size of all indexes in MB

Total size of all indexes in MB
sourceraw docstring

total-table-sizeclj

(total-table-size db)
(total-table-size db params)
(total-table-size db params options & command-options)

Size of the tables (including indexes), descending by size

Size of the tables (including indexes), descending by size
sourceraw docstring

unused-indexesclj

(unused-indexes db)
(unused-indexes db params)
(unused-indexes db params options & command-options)

Unused and almost unused indexes

Unused and almost unused indexes
sourceraw docstring

vacuum-statsclj

(vacuum-stats db)
(vacuum-stats db params)
(vacuum-stats db params options & command-options)

Dead rows and whether an automatic vacuum is expected to be triggered

Dead rows and whether an automatic vacuum is expected to be triggered
sourceraw docstring

viewsclj

(views db)
(views db params)
(views db params options & command-options)

List all view objects in current database

List all view objects in current database
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close