Collections Statistics
View statistics for all collections in a database simultaneously with a comprehensive table interface. Compare collection sizes, document counts, index usage, and storage efficiency across your entire database to identify optimization opportunities and monitor database-wide health.
Quick Start
Access the all-collections statistics view to compare collections:
- In the sidebar, right-click on a database (not a specific collection)
- Select All Collections Statistics from the context menu
- The stats table loads showing all collections in the database
- Review the table columns to compare metrics across collections
- Double-click any collection row to drill into detailed statistics for that collection
- Enable Auto-refresh to monitor changes in real-time (30-second intervals)
Table Columns Explained
The collections table displays 8 columns of metrics for each collection in the database:
| Column |
Metric |
Description |
Collection |
Collection name |
Name of the collection with a colored status indicator (green=loaded, yellow=loading, red=error) |
Documents |
Total document count |
Number of documents in the collection (stats.count), formatted with thousands separators |
Storage Size |
Compressed storage size |
Allocated disk space including compression (stats.storageSize) |
Data Size |
Uncompressed data size |
Total size of all documents before compression (stats.size) |
Indexes |
Number of indexes |
Count of indexes defined on the collection (stats.nindexes), including the default _id index |
Index Size |
Total index storage |
Combined size of all indexes on the collection (stats.totalIndexSize) |
Avg Object Size |
Average document size |
Average size per document in the collection (stats.avgObjSize) |
Efficiency |
Storage efficiency |
Percentage of storage actually in use with visual progress bar: (data size / storage size) × 100 |
Status Indicators
Each collection row displays a colored dot indicator showing the loading status:
- Green Dot - Statistics successfully loaded for this collection
- Yellow Dot (pulsing) - Statistics are currently loading for this collection
- Red Dot - Error loading statistics (check permissions or collection accessibility)
When statistics fail to load for a collection, the row displays "-" for all metric columns and shows the red error indicator.
Storage Efficiency Visualization
The Efficiency column includes both a visual progress bar and a percentage value:
Understanding the Efficiency Bar
- Gradient Color - Blue to green gradient indicates healthy efficiency
- Bar Length - Longer bar = higher efficiency (less wasted space)
- Percentage Value - Exact efficiency ratio displayed next to the bar
- 100% Efficiency - All allocated storage is being used (ideal)
- Low Efficiency - Indicates significant free space that could be reclaimed
Efficiency Thresholds
- 90-100% - Excellent: Minimal wasted space
- 70-90% - Good: Normal for active collections
- 50-70% - Fair: Monitor for potential optimization
- Below 50% - Poor: Consider running
compact to reclaim space
Comparing Collections
Use the all-collections table to identify patterns and outliers across your database:
Key Comparisons
- Largest Collections - Sort by Storage Size or Data Size to find collections consuming the most disk space
- Most Documents - Sort by Documents column to find high-volume collections
- Index Overhead - Compare Index Size to Data Size; high ratios may indicate over-indexing
- Average Document Size - Identify collections with unusually large or small documents
- Low Efficiency - Find collections with wasted space that need maintenance
Identifying Optimization Opportunities
- Index Bloat - Collections where Index Size exceeds Data Size may have redundant indexes
- Large Documents - High Avg Object Size may indicate embedded documents that should be referenced instead
- Empty Collections - 0 documents but allocated storage suggests the collection can be dropped or compacted
- Fragmented Collections - Low efficiency after deletions indicates compaction needed
The sticky footer at the bottom of the table displays summary information:
- Total Collections - Total number of collections in the database
- Loaded - Number of collections that successfully loaded statistics (shown in green)
- Loading Progress - Shows "Loaded: X / Y" to track loading progress
The footer remains visible as you scroll through the table, providing context about the overall status.
Double-Click Navigation
Double-click any collection row to open the detailed Collection Statistics view for that collection:
- A new tab opens showing the 4-tab detailed statistics interface (Overview, Indexes, Cache, Storage)
- The tab is named "Collection Stats - [collection name]"
- You can keep the all-collections view open in another tab for quick comparison
- Use this to drill down when you identify collections needing closer inspection
Tip: After identifying problematic collections in the overview table, double-click to analyze them in detail.
Auto-Refresh Feature
Enable the Auto-refresh checkbox in the top-right controls to monitor all collections in real-time:
- Refresh Interval - Statistics reload every 30 seconds (default)
- Parallel Loading - Statistics for all collections are fetched in parallel for faster updates
- Status Tracking - Each collection shows its loading status independently
- Error Resilience - If one collection fails, others continue loading successfully
Use Cases for Auto-Refresh
- Monitoring database growth during bulk imports across multiple collections
- Tracking storage changes after running maintenance operations
- Observing index build progress on multiple collections
- Watching efficiency metrics improve after running compact operations
Performance Note: Auto-refresh executes db.collection.stats() for each collection. For databases with many collections (50+), consider manual refresh instead.
Available Actions
Refresh Statistics
Click the Refresh button to reload statistics for all collections. This executes db.collection.stats() for each collection in parallel.
Enable Auto-Refresh
Check the Auto-refresh checkbox to automatically reload statistics every 30 seconds for continuous monitoring.
Open Collection Details
Double-click any collection row to open the detailed 4-tab Collection Statistics view for deeper analysis.
Sort by Column
Click column headers to sort the table by that metric (e.g., sort by Storage Size to find largest collections).
Pro Tips
- Spot Check Regularly: Review the all-collections table weekly to identify collections growing rapidly or showing low efficiency.
- Index Ratio Analysis: Calculate index-to-data ratio by comparing Index Size to Data Size. Ratios above 1.0 suggest reviewing your indexing strategy.
- Find Fragmentation: Collections with low efficiency (below 70%) after deletions need
compact to reclaim space. Schedule during maintenance windows.
- Document Size Warnings: Very large average document sizes (>1MB) may indicate embedded documents that should be split into separate collections.
- Capacity Planning: Export the table data and track growth trends over time to predict when you'll need additional storage capacity.
- Quick Triage: Use the status indicators (colored dots) to quickly identify collections with loading errors that may have permission or accessibility issues.
VisualLeaf optimizes the all-collections view by loading statistics in parallel:
How It Works
- Batch Requests - All collection stats are requested simultaneously using RxJS forkJoin
- Independent Loading - Each collection loads independently; one failure doesn't block others
- Progressive Display - Collections appear with yellow loading indicators, then update to green when loaded
- Error Isolation - Collections that fail to load show red indicators while others continue
- Small Databases (1-20 collections) - Loading is nearly instant
- Medium Databases (20-50 collections) - Loading takes 1-3 seconds
- Large Databases (50+ collections) - May take 5-10 seconds; consider disabling auto-refresh
- Server Impact - Each collection executes
db.collection.stats(); minimal impact due to metadata reads
Understanding the Stats Commands
For each collection in the database, VisualLeaf executes:
// For each collection
db.collection.stats({ scale: 1 })
These commands are executed in parallel using efficient batching to minimize load time.
- Read-Only Operation - No data modification, only metadata reads
- Brief Locks - Short read locks per collection; safe for production
- Cache Friendly - Stats are often served from WiredTiger's cache
- Parallel Execution - Multiple stats commands run concurrently
Troubleshooting
Red Status Indicators (Failed to Load)
If some collections show red dots and "-" for all metrics:
- Permission Issues - Verify your user has read permissions on all collections
- Views vs Collections - Views may not return standard stats; this is normal
- System Collections - Some system collections have restricted access
- Connection Issues - Temporary network issues may cause individual failures
Slow Loading
If the table takes a long time to load:
- Many Collections - Databases with 100+ collections naturally take longer
- Large Collections - Stats for very large collections take more time to calculate
- Server Load - High server load may slow stats calculations
- Network Latency - Remote connections have additional overhead
Unexpected Efficiency Values
If efficiency percentages seem incorrect:
- Recent Deletions - Efficiency drops after deletions; run
compact to reclaim space
- Compression - WiredTiger compression can make efficiency exceed 100% (data size > storage size)
- Free Space Allocation - MongoDB pre-allocates space; normal for growing collections