Large Database Optimization
This guide shows how to use the vCon MCP Server efficiently with large databases to prevent memory exhaustion and improve performance.
Problem: Memory Exhaustion with Large Databases
When working with large databases (10,000+ vCons), standard queries can return massive amounts of data that exhaust the LLM's memory. For example:
// ❌ BAD: This can return 100+ full vCons and exhaust memory
{
"query": "what happened last week",
"limit": 100
}Solution: Smart Response Formatting and Limits
1. Check Database Size First
Before running queries, check the database size to understand the scale:
// Get database size and recommendations
{
"include_recommendations": true
}Response:
2. Get Smart Limits for Your Query
Get recommended limits based on query type and expected result size:
Response:
3. Use Appropriate Response Formats
Metadata Format (Recommended for Large Databases)
Response:
IDs Only Format (For Further Processing)
Response:
Snippets Format (For Content Search)
Response:
4. Batch Processing for Large Results
When you need to process many results, use IDs-only format and then fetch individual vCons:
5. Use Analytics Tools for Overview
For understanding patterns without loading individual records:
Best Practices
1. Always Check Database Size First
2. Use Metadata Format by Default
3. Use Pagination for Large Results
4. Use Analytics for Patterns
Response Format Comparison
full
~50KB per vCon
Detailed analysis
❌ No (large DBs)
metadata
~200 bytes per vCon
Overview, filtering
✅ Yes
snippets
~500 bytes per result
Content search
✅ Yes
ids_only
~36 bytes per vCon
Batch processing
✅ Yes
Memory Usage Examples
For a database with 50,000 vCons:
Full format (100 results): ~5MB (❌ Memory exhaustion)
Metadata format (100 results): ~20KB (✅ Safe)
IDs only (100 results): ~3.6KB (✅ Very safe)
Snippets (100 results): ~50KB (✅ Safe)
Summary
Check database size before running queries
Use smart limits based on database size
Default to metadata format for large databases
Use IDs-only for batch processing
Use analytics tools for pattern analysis
Implement pagination for large result sets
This approach ensures efficient operation with databases of any size while preventing memory exhaustion.
Last updated