Skip to content

v2.12.0

Latest

Choose a tag to compare

@tommyknocker tommyknocker released this 12 Dec 03:26

Release v2.12.0 - Database Optimization & AI-Powered Analysis

Release Date: December 12, 2025

🎉 Major Features

New pdodb optimize Command

Comprehensive database optimization tool with four powerful subcommands:

  • pdodb optimize analyze - Analyze entire database schema for optimization opportunities
  • pdodb optimize structure - Analyze specific table structure
  • pdodb optimize logs - Analyze slow query logs
  • pdodb optimize query - Analyze and optimize specific SQL queries

Features:

  • Detects missing indexes, redundant indexes, and missing foreign key indexes
  • Suggests indexes for common patterns (soft delete, status columns, timestamps)
  • Identifies large tables that may benefit from partitioning
  • Provides detailed statistics and recommendations
  • Support for JSON, table, and YAML output formats

New pdodb ai Command - AI-Powered Database Analysis

Intelligent database optimization powered by AI with support for 6 major AI providers:

Subcommands:

  • pdodb ai query <sql> - Get AI-powered query analysis and optimization suggestions
  • pdodb ai schema [table] - Analyze database schema with AI recommendations
  • pdodb ai optimize - AI-powered database optimization suggestions

Supported AI Providers:

  • OpenAI (GPT-4, GPT-3.5-turbo, GPT-4-turbo)
  • Anthropic (Claude 3 Opus, Sonnet, Haiku)
  • Google (Gemini Pro, Gemini Pro Vision)
  • Microsoft Azure OpenAI (GPT-4, GPT-3.5-turbo)
  • DeepSeek (DeepSeek Chat, DeepSeek Coder)
  • Yandex Cloud GPT (YandexGPT, YandexGPT Lite)

Features:

  • Automatic EXPLAIN plan integration for better AI analysis
  • Configurable temperature, max_tokens, and timeout settings
  • Progress indicators for long-running AI requests
  • Integration with explainAiAdvice() method in QueryBuilder
  • Enhanced markdown formatting in AI responses

⚡ Performance Improvements

  • ~25% faster schema analysis - Optimized SchemaAnalyzer to reduce duplicate database queries
  • Eliminated redundant TableManager::info() and getForeignKeys() calls
  • Optimized getTableRowCount() to only execute for tables with detected issues
  • Removed unnecessary tableExists() checks
  • Added filtering for Oracle system tables (BIN$%, SYS_%, DUAL)
  • Added filtering for MSSQL system schemas (sys, INFORMATION_SCHEMA)
  • Improved test execution time for Oracle optimize tests (32s → 24s)

🔧 Improvements

Code Quality

  • Removed #[RunInSeparateProcess] attributes from tests
  • Improved test reliability by throwing exceptions instead of exit() in test environment
  • Better handling of non-interactive mode in CLI commands
  • Extracted magic numbers to constants in AI providers

Test Reliability

  • Fixed blocking input issues in non-interactive test environments
  • Fixed "risky tests" warnings by properly managing output buffers
  • Fixed MSSQL test failures in GitHub Actions (environment variable handling)
  • Fixed Oracle test timeouts and hanging issues
  • Preserved critical environment variables in test tearDown methods
  • Improved non-interactive mode detection across all CLI commands

🐛 Bug Fixes

  • Fixed AI command output formatting
  • Fixed schema analysis in AI command
  • Improved Yandex AI provider response handling
  • Fixed MSSQL listTables() to filter system schemas for better performance
  • Fixed Oracle system table filtering in listTables()
  • Removed redundant ai analyze command (consolidated into ai query)

📚 Documentation

  • Updated composer.json with AI integration keywords and description
  • Removed references to deprecated ai analyze command
  • Updated bash completion script to remove ai analyze command

📦 Installation

composer update tommyknocker/pdo-database-class## 🔗 Links


Full Changelog: v2.11.2...v2.12.0