NAME
DBIx::Fast::Profile::MariaDB - MariaDB/MySQL profiling and diagnostics
DESCRIPTION
Provides MariaDB-native query profiling, index analysis, and connection monitoring using information_schema and performance_schema. Extends DBIx::Fast::Profile::Base.
METHODS
init
Enables MariaDB session profiling (SET profiling = 1) and configures history size and resource usage tracking.
get_slow_queries
Returns queries from information_schema.profiling whose total duration exceeds the slow_query threshold.
get_query_profile
my $profile = $mariadb->get_query_profile($query_id);
Returns detailed stage-by-stage profiling data for a specific query ID, including CPU, I/O, and memory metrics.
get_stats
Returns a hashref with global server status counters and session-level query statistics for the current connection.
print_stats
Prints a formatted report of global and session query statistics.
explain_query
my $plan = $mariadb->explain_query($sql, @params);
Runs EXPLAIN EXTENDED on the given SQL and returns the execution plan.
get_table_stats
my $stats = $mariadb->get_table_stats($table);
Returns table metadata from information_schema.tables including engine, row count, and data/index sizes.
get_index_stats
my $stats = $mariadb->get_index_stats($table);
Returns index column details and cardinality from information_schema.statistics.
analyze_indexes
my $analysis = $mariadb->analyze_indexes($table);
Performs a comprehensive index analysis combining schema metadata with performance_schema usage data. Returns indexes, detected problems, and optimization recommendations.
print_index_analysis
$mariadb->print_index_analysis($table);
Prints a formatted index analysis report for the given table, including usage stats, problems, and recommendations.
get_index_metrics
my $metrics = $mariadb->get_index_metrics($table);
Returns per-index I/O wait metrics (reads, writes, fetches, latency) from performance_schema.
monitor_connections
my $stats = $mariadb->monitor_connections();
Returns a comprehensive snapshot of current connections, processes, variables, status counters, per-user usage, and detected problems.
print_connection_monitor
Prints a formatted connection monitoring report including active processes, settings, status, and any detected problems.
start_connection_monitor
$mariadb->start_connection_monitor($interval, $duration);
Runs a continuous connection monitor that refreshes every $interval seconds (default 60) for up to $duration seconds (default 3600).
AUTHOR
Harun Delgado
LICENSE
This is free software under the Artistic License 2.0.