Skip to content

← Back to Index

🚀 Getting Started

Welcome to IQToolkit Analyzer!

For a quick overview, see the Project README.

Installation

git clone https://github.com/iqtoolkit/iqtoolkit-analyzer.git
cd iqtoolkit-analyzer
poetry install --with dev,test

If you want to use local LLMs, see Ollama Local Setup for installation and usage instructions.

Basic Usage

PostgreSQL Analysis

🔥 NEW: Database-Direct EXPLAIN Analysis

The fastest way to analyze queries is now running EXPLAIN directly against your database:

# 1. Create IQToolkit config file
cp ~/.iqtoolkit/config.yaml.example ~/.iqtoolkit/config.yaml
# Edit config.yaml to add your database connection details

# 2. Run EXPLAIN on any query
poetry run python -m iqtoolkit_analyzer \
  --config ~/.iqtoolkit/config.yaml \
  postgresql \
  --db-name my_database \
  --sql "SELECT * FROM users WHERE email = 'test@example.com'" \
  --output analysis.md

# Or analyze a SQL file
poetry run python -m iqtoolkit_analyzer \
  --config ~/.iqtoolkit/config.yaml \
  postgresql \
  --db-name my_database \
  --query-file slow_query.sql \
  --output analysis.md

Traditional Methods:

See PostgreSQL Examples for all CLI and log analysis examples.

Quick commands: - Analyze a log file: poetry run python -m iqtoolkit_analyzer postgresql /path/to/postgresql.log - Analyze a standalone EXPLAIN JSON file: poetry run python -m iqtoolkit_analyzer postgresql --plan slow_query_plan.json

MongoDB Analysis

MongoDB analysis uses the built-in profiler to collect slow operation data in real-time:

1. Enable MongoDB Profiling

# Connect to MongoDB
mongosh "mongodb://localhost:27017/myapp"

# Enable profiling for operations slower than 100ms
db.setProfilingLevel(2, {slowms: 100})

# Verify profiling is enabled
db.getProfilingStatus()

2. Run Analysis

# Basic analysis with connection string
poetry run python -m iqtoolkit_analyzer mongodb --connection-string "mongodb://localhost:27017" --output ./reports

# Advanced analysis with configuration file
cp docs/examples/.mongodb-config.yml.example .mongodb-config.yml
# Edit .mongodb-config.yml for your environment
poetry run python -m iqtoolkit_analyzer mongodb --config .mongodb-config.yml --output ./reports

# Generate multiple report formats
poetry run python -m iqtoolkit_analyzer mongodb \
  --connection-string "mongodb://localhost:27017" \
  --output ./reports \
  --format json html markdown

3. View Reports

  • JSON Report: Machine-readable analysis data (mongodb_analysis.json)
  • HTML Report: Interactive dashboard with charts (mongodb_report.html)
  • Markdown Report: Human-readable summary (mongodb_analysis.md)

See MongoDB Guide for complete setup and usage instructions.

Configuration File

You can use a .iqtoolkit-analyzer.yml file to set defaults for log format, thresholds, and output. See Configuration.

Dependencies

If installing manually, ensure you have pyyaml, pandas, and tqdm for all features.