Skip to content

Database Stats

Operations Summary

Method Endpoint Description
GET /api/database-stats/ Get comprehensive database statistics

Get comprehensive database statistics

Retrieves comprehensive statistics about the PostgreSQL database including: - Table statistics: Top 10 largest tables by size - Connection statistics: Active, idle, and waiting connections with utilization - Database size: Total size, data size, and index size - Cache performance: Buffer cache and index hit ratios (should be >99%) - Transaction statistics: Commits, rollbacks, deadlocks - Lock statistics: Current locks and waiting queries - Maintenance statistics: Dead tuples, vacuum needs, oldest transaction age - Active queries: Currently running queries with duration - Query performance: Sequential vs index scan ratios - Replication status: WAL size and replication lag (if applicable)

This information is useful for monitoring, debugging, and performance tuning. Requires support user permissions.

1
2
3
4
http \
  GET \
  https://api.example.com/api/database-stats/ \
  Authorization:"Token YOUR_API_TOKEN"
1
2
3
4
5
6
7
8
9
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.api.database_stats import database_stats_retrieve # (1)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
response = database_stats_retrieve.sync(client=client)

print(response)
  1. API Source: database_stats_retrieve
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import { databaseStatsRetrieve } from 'waldur-js-client';

try {
  const response = await databaseStatsRetrieve({
  auth: "Token YOUR_API_TOKEN"
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}

200 -

Field Type Description
table_stats array of objects Top largest tables by size
table_stats.table_name string Name of the database table
table_stats.total_size integer Total size of the table in bytes
table_stats.data_size integer Size of the actual data in bytes
table_stats.external_size integer Size of external data (e.g., TOAST) in bytes
connections any Connection statistics
database_size any Database size information
cache_performance any Cache hit ratios and memory settings
transactions any Transaction commit/rollback statistics
locks any Current lock statistics
maintenance any Vacuum and maintenance statistics
active_queries any Currently running queries
query_performance any Query performance indicators
replication any Replication status (if applicable)