All Projects → mgartner → Pg_flame

mgartner / Pg_flame

Licence: apache-2.0
A flamegraph generator for Postgres EXPLAIN ANALYZE output.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Pg flame

Prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite & MongoDB (Preview)
Stars: ✭ 18,168 (+1206.11%)
Mutual labels:  database, postgresql, postgres
Goqu
SQL builder and query library for golang
Stars: ✭ 984 (-29.26%)
Mutual labels:  database, postgresql, postgres
Go Kallax
Kallax is a PostgreSQL typesafe ORM for the Go language.
Stars: ✭ 853 (-38.68%)
Mutual labels:  database, postgresql, postgres
Docker Postgres
A docker container running PostgreSQL
Stars: ✭ 22 (-98.42%)
Mutual labels:  database, postgresql, postgres
Pgcli
Postgres CLI with autocompletion and syntax highlighting
Stars: ✭ 9,985 (+617.83%)
Mutual labels:  database, postgresql, postgres
Node Pg Migrate
Node.js database migration management for Postgresql
Stars: ✭ 838 (-39.76%)
Mutual labels:  database, postgresql, postgres
Activerecord Clean Db Structure
Automatic cleanup for the Rails db/structure.sql file (ActiveRecord/PostgreSQL)
Stars: ✭ 101 (-92.74%)
Mutual labels:  database, postgresql, postgres
Pgmetrics
Collect and display information and stats from a running PostgreSQL server
Stars: ✭ 612 (-56%)
Mutual labels:  database, postgresql, postgres
Pgtune
Pgtune - tuning PostgreSQL config by your hardware
Stars: ✭ 1,078 (-22.5%)
Mutual labels:  database, postgresql, performance
Postgresclientkit
A PostgreSQL client library for Swift. Does not require libpq.
Stars: ✭ 49 (-96.48%)
Mutual labels:  database, postgresql, postgres
Efcore.pg
Entity Framework Core provider for PostgreSQL
Stars: ✭ 838 (-39.76%)
Mutual labels:  database, postgresql, postgres
Powa Web
PoWA user interface
Stars: ✭ 66 (-95.26%)
Mutual labels:  database, postgresql, performance
Metabase
The simplest, fastest way to get business intelligence and analytics to everyone in your company 😋
Stars: ✭ 26,803 (+1826.89%)
Mutual labels:  database, postgresql, postgres
Electrocrud
Database CRUD Application Built on Electron | MySQL, Postgres, SQLite
Stars: ✭ 1,267 (-8.91%)
Mutual labels:  database, postgresql, postgres
Blog
Everything about database,business.(Most for PostgreSQL).
Stars: ✭ 6,330 (+355.07%)
Mutual labels:  database, postgresql, postgres
Awesome Postgres
A curated list of awesome PostgreSQL software, libraries, tools and resources, inspired by awesome-mysql
Stars: ✭ 7,468 (+436.88%)
Mutual labels:  database, postgresql, postgres
Sqlboiler
Generate a Go ORM tailored to your database schema.
Stars: ✭ 4,497 (+223.29%)
Mutual labels:  database, postgresql, postgres
Citus
Distributed PostgreSQL as an extension
Stars: ✭ 5,580 (+301.15%)
Mutual labels:  database, postgresql, postgres
Niklick
Rails Versioned API solution template for hipsters! (Ruby, Ruby on Rails, REST API, GraphQL, Docker, RSpec, Devise, Postgress DB)
Stars: ✭ 39 (-97.2%)
Mutual labels:  database, postgresql, postgres
Squid
🦑 Provides SQL tagged template strings and schema definition functions.
Stars: ✭ 57 (-95.9%)
Mutual labels:  database, postgresql, postgres

pg_flame Version Build Status

A flamegraph generator for Postgres EXPLAIN ANALYZE output.

Demo

Try the demo here.

Installation

Homebrew

You can install via Homebrew with the follow command:

$ brew install mgartner/tap/pg_flame

Download pre-compiled binary

Download one of the compiled binaries in the releases tab. Once downloaded, move pg_flame into your $PATH.

Docker

Alternatively, if you'd like to use Docker to build the program, you can.

$ docker pull mgartner/pg_flame

Build from source

If you'd like to build a binary from the source code, run the following commands. Note that compiling requires Go version 1.13+.

$ git clone https://github.com/mgartner/pg_flame.git
$ cd pg_flame
$ go build

A pg_flame binary will be created that you can place in your $PATH.

Usage

The pg_flame program reads a JSON query plan from standard input and writes the flamegraph HTML to standard ouput. Therefore you can pipe and direct input and output however you desire.

Example: One-step

$ psql dbname -qAtc 'EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) SELECT id FROM users' \
    | pg_flame \
    > flamegraph.html \
    && open flamegraph.html

Example: Multi-step with SQL file

Create a SQL file with the EXPLAIN ANALYZE query.

-- query.sql
EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON)
SELECT id
FROM users

Then run the query and save the JSON to a file.

$ psql dbname -qAtf query.sql > plan.json

Finally, generate the flamegraph HTML.

$ cat plan.json | pg_flame > flamegraph.html

Example: Docker

If you've followed the Docker installation steps above, you can pipe query plan JSON to a container and save the output HTML.

$ psql dbname -qAtc 'EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) SELECT id FROM users' \
    | docker run -i pg_flame \
    > flamegraph.html

Background

Flamegraphs were invented by Brendan Gregg to visualize CPU consumption per code-path of profiled software. They are useful visualization tools in many types of performance investigations. Flamegraphs have been used to visualize Oracle database query plans and query executions , proving useful for debugging slow database queries.

Pg_flame is in extension of that work for Postgres query plans. It generates a visual hierarchy of query plans. This visualization identifies the relative time of each part of a query plan.

This tool relies on the spiermar/d3-flame-graph plugin to generate the flamegraph.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].