Skip to content

papakvy/sql_doctor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL Doctor

Requirements

  • curl or wget for quick install
  • Rust toolchain with cargo for source builds
  • make for local development

Local Testing

make test

Installation Instructions

1. Install

System install to /usr/local/bin:

curl -fsSL https://raw.githubusercontent.com/papakvy/sql_doctor/main/install.sh | bash -s -- --system

Latest release to $HOME/.local/bin:

curl -fsSL https://raw.githubusercontent.com/papakvy/sql_doctor/main/install.sh | bash

Specific release:

curl -fsSL https://raw.githubusercontent.com/papakvy/sql_doctor/main/install.sh | bash -s -- --version v2.0.5

Temporary build from the current main branch:

curl -fsSL https://raw.githubusercontent.com/papakvy/sql_doctor/main/install.sh | bash -s -- --from-git main

Build and install from source:

[sudo] make install

Custom prefix:

make install PREFIX="$HOME/.local"

If you install to a custom prefix, make sure the target bin directory is on your PATH:

export PATH="$HOME/.local/bin:$PATH"

2. Verify

sql_doctor -v

# sql_doctor 2.0.5 (2026-06-10)

3. Usage

  • Default value: --execution-time = 1000, --top = 15 and --multiple-pattern = n

Use the installed command:

sql_doctor /path/to/log/file.log

Or run the development binary from the repository:

cargo run -- /path/to/log/file.log

The previous Bash implementation is kept as sql_doctor.bash for comparison and benchmarking:

./sql_doctor.bash /path/to/log/file.log
sql_doctor -e 5000 /path/to/log/file.log

# Explain
  - Get all SQLs in the `/path/to/log/file.log` with  `--execution-time >= 5000 miliseconds`
  • Keep only the top N slowest SQLs before sorting the final output. The default is --top 15.
sql_doctor -e 1000 --top 100 /path/to/log/file.log
  • Include every matching SQL instead of limiting the report to top results.
sql_doctor -e 1000 --all /path/to/log/file.log

4. Uninstall

[sudo] make uninstall

If you installed with a custom prefix, uninstall with the same prefix:

make uninstall PREFIX="$HOME/.local"

5. Contributing

  • Fork it ( https://github.com/papakvy/sql_doctor/fork )
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request

Docker

You can build and run SQL Doctor as a container.

Build locally

docker build -t sql_doctor .

Run

docker run --rm -v "$PWD:/data" sql_doctor -e 1000 /data/path/to/logfile.log

Publish on GitHub Container Registry

The repository now includes a GitHub Actions workflow that publishes a Docker image to GHCR when you push a tag like v1.0.7.

docker pull ghcr.io/<owner>/sql_doctor:v1.0.7

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors