Packages
Ecto PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
Current section
Files
Jump to
Current section
Files
lib/ecto_psql_extras.ex
defmodule EctoPSQLExtras do
@queries [
:bloat, :blocking, :cache_hit, :calls,
:extensions, :table_cache_hit, :index_cache_hit, :index_size,
:index_usage, :locks, :all_locks, :long_running_queries,
:mandelbrot, :outliers, :records_rank, :seq_scans,
:table_indexes_size, :table_size, :total_index_size, :total_table_size,
:unused_indexes, :vacuum_stats, :kill_all
]
def query([name: name, repo: repo]) do
sql_query = File.read(
"#{File.cwd!}/lib/queries/#{name}.sql"
)
repo.query(sql_query)
end
end