{% extends "base.html" %} {% block title %} 数据库元信息 - Amrita Dashboard{% endblock %} {% block extra_head %} {% endblock %} {% block content %}
{% if error %}
错误
错误信息: {{ error }}
{% endif %}
数据库基本信息
数据库类型: {{ db_type }}
数据库版本: {{ db_info.version or 'N/A' }}
数据库名称: {{ db_info.database_name or db_info.db_name or 'N/A' }}
当前用户: {{ db_info.current_user or 'N/A' }}
{% if db_info.server_ip is not none %}
服务器IP: {{ db_info.server_ip }}
{% endif %} {% if db_info.start_time is not none %}
启动时间: {{ db_info.start_time }}
{% endif %}
采集时间: {{ collection_timestamp }}
连接统计
总连接数: {{ connection_stats.total_connections or 0 }}
活跃连接数: {{ connection_stats.active_connections or 0 }}
空闲连接数: {{ connection_stats.idle_connections or 0 }}
{% if connection_stats.max_allowed_connections is not none %}
最大连接数: {{ connection_stats.max_allowed_connections }}
连接利用率: {{ "%.2f"|format(connection_stats.connection_utilization_percent|default(100)|float) }}%
{% endif %} {% if connection_stats.longest_query_seconds is not none %}
最长查询时间: {{ "%.2f"|format(connection_stats.longest_query_seconds|float) }}秒
{% endif %} {% if connection_stats.waiting_connections is not none %}
等待连接数: {{ connection_stats.waiting_connections }}
{% endif %}
缓存效率
{% if cache_efficiency.buffer_pool_hit_ratio is not none %}
缓冲池命中率: {{ "%.2f"|format(cache_efficiency.buffer_pool_hit_ratio|float) }}%
{% endif %} {% if cache_efficiency.heap_hit_ratio is not none %}
堆命中率: {{ "%.2f"|format(cache_efficiency.heap_hit_ratio|float) }}%
{% endif %} {% if cache_efficiency.index_hit_ratio is not none %}
索引命中率: {{ "%.2f"|format(cache_efficiency.index_hit_ratio|float) }}%
{% endif %} {% if cache_efficiency.logical_reads is not none %}
逻辑读取: {{ cache_efficiency.logical_reads }}
{% endif %} {% if cache_efficiency.physical_reads is not none %}
物理读取: {{ cache_efficiency.physical_reads }}
{% endif %} {% if cache_efficiency.cache_size_mb is not none %}
缓存大小: {{ "%.2f"|format(cache_efficiency.cache_size_mb|float) }} MB
{% endif %} {% if cache_efficiency.cache_used_percent is not none %}
缓存使用率: {{ "%.2f"|format(cache_efficiency.cache_used_percent|float) }}%
{% endif %}
表活动统计 (Top 10)
{% for table in table_activity %} {% endfor %}
表名 全表扫描 插入行数 更新行数 删除行数 存活行数 大小(MB)
{{ table.table_name }} {{ table.full_scans or 0 }} {{ table.rows_inserted or 0 }} {{ table.rows_updated or 0 }} {{ table.rows_deleted or 0 }} {{ table.live_rows or 0 }} {{ "%.2f"|format(table.total_size_mb|default(0)|float) if table.total_size_mb else 'N/A' }}
{% if table_activity|length == 0 %}

暂无表活动数据

{% endif %}
索引使用情况 (Top 10)
{% for idx in index_usage %} {% endfor %}
索引名 表名 扫描次数 获取行数 大小(MB) 唯一性
{{ idx.index_name }} {{ idx.table_name }} {{ idx.scan_count or 0 }} {{ idx.rows_fetched or 0 }} {{ "%.2f"|format(idx.size_mb|default(0)|float) if idx.size_mb else 'N/A' }} {{ '是' if idx.unique else '否' }}
{% if index_usage|length == 0 %}

暂无索引使用数据

{% endif %}
查询统计 (Top 10)
{% for query in query_stats %} {% endfor %}
查询文本 执行次数 平均耗时(ms) 总耗时(ms) 返回行数
{{ query.query_text[:100] ~ '...' if query.query_text and query.query_text|length > 100 else (query.query_text or 'N/A') }} {{ query.total_executions or 0 }} {{ "%.2f"|format(query.avg_time_ms|default(0)|float) if query.avg_time_ms else 'N/A' }} {{ "%.2f"|format(query.total_time_ms|default(0)|float) if query.total_time_ms else 'N/A' }} {{ query.rows_returned or 0 }}
{% if query_stats|length == 0 %}

暂无查询统计数据

{% endif %}
锁信息
{% for lock in lock_info %} {% endfor %}
锁类型 锁模式 锁数量 等待数量
{{ lock.lock_type }} {{ lock.lock_mode }} {{ lock.lock_count }} {{ lock.waiting_count or 0 }}
{% if lock_info|length == 0 %}

暂无锁信息

{% endif %}
{% endblock %}