graphman.
Prerequisites
graphman command is included in official Graph Node containers. You can access it via:Logging Configuration
Graphman respects theGRAPH_LOG environment variable. To reduce log noise:
Verify Setup
Confirm graphman is configured correctly:Removing Unused Deployments
When you deploy a new version of a subgraph, the previous version’s data remains in the database even after it’s no longer served for queries. These unused deployments consume storage and should be periodically cleaned up.Understanding Unused Deployments
A deployment is considered unused when it meets all of these criteria:- Not assigned to any node
- Either not marked as active, or is neither the current nor pending version of a subgraph
- Not the source of a currently running copy operation
Cleanup Process
Record unused deployments
unused_deployments table in the primary shard.Review the list
Remove unused deployments
Removal Options
Theunused remove command supports several options for fine-grained control:
Remove all unused deployments
Remove all unused deployments
unused record.Remove deployments older than a specific time
Remove deployments older than a specific time
Remove a specific deployment
Remove a specific deployment
Limit the number of removals
Limit the number of removals
Removing a Subgraph
To stop serving a specific subgraph and free its name for reuse:Remove the subgraph name mapping
Mark the deployment as unused
Remove the deployment data
Modifying Assignments
Each deployment is assigned to a specific Graph Node instance for indexing. You can modify these assignments to control which node indexes which subgraphs.Reassigning Deployments
Move a deployment to a different node:<deployment>- The deployment identifier (name, IPFS hash, or namespace)<new-node-id>- The target node ID from your Graph Node configuration
- Load balancing across multiple nodes
- Moving deployments off a node before maintenance
- Isolating problematic subgraphs
Unassigning Deployments
Permanently stop indexing a deployment:Pausing Indexing
To temporarily pause a deployment without losing its assignment:Complete Deployment Removal
To fully remove a deployment in a single operation:Retrieve deployment info
Unassign from node
Remove subgraph name
Mark as unused
Delete all data
Drop Command Options
Drop by subgraph name
Drop by subgraph name
Drop by IPFS hash
Drop by IPFS hash
Drop only current versions
Drop only current versions
Drop only pending versions
Drop only pending versions
Skip confirmation prompt
Skip confirmation prompt
Maintenance Workflows
Regular Cleanup Schedule
Establish a routine maintenance schedule:Weekly: Identify unused deployments
Weekly: Review and remove
Monthly: Audit active deployments
Pre-Deployment Cleanup
Before deploying a new version:Check current deployment info
Deploy new version
Wait for sync completion
Clean up old version
Node Maintenance
When performing maintenance on a Graph Node instance:List deployments on the node
Reassign critical deployments
Pause remaining deployments
Perform maintenance
Restore assignments
Best Practices
Verify before deleting
Verify before deleting
graphman info and unused list to confirm which deployments will be affected before running destructive operations.Use time buffers
Use time buffers
--older flag.Monitor disk usage
Monitor disk usage
Document assignments
Document assignments
Test in staging
Test in staging
Automate routine tasks
Automate routine tasks
Keep deployment history
Keep deployment history
Troubleshooting Common Issues
Deployment won’t unassign
Symptom: Unassign command fails or deployment continues indexing. Solutions:- Verify the deployment identifier is correct
- Check that no queries are actively using the deployment
- Ensure the node is not restarting or in an error state
Unused remove doesn’t delete deployment
Symptom: Deployment remains in database afterunused remove.
Causes and solutions:
- Not marked as unused: Run
graphman unused recordfirst - Still assigned: Unassign the deployment before marking as unused
- Recent deployment: Use
--older 0to remove immediately (not recommended) - Active queries: Wait for queries to complete
Can’t reassign deployment
Symptom: Reassign command fails or assignment doesn’t change. Solutions:- Verify the target node ID exists in your configuration
- Check that the target node is running and connected to the database
- Ensure the deployment isn’t in a failed state
- Try unassigning first, then creating a new assignment
Database space not freed after removal
Symptom: Disk usage remains high after removing deployments. Solutions:- Run PostgreSQL’s
VACUUM FULLon affected schemas (requires downtime) - Consider using
VACUUMregularly to mark space as reusable - Check for other large tables or indexes
- Monitor the primary shard’s
unused_deploymentstable size
Automation Examples
Daily Cleanup Script
Deployment Migration Script
Additional Resources
- Graphman CLI Reference - Complete command documentation
- Configuration File Guide - Setup and configuration
- Monitoring Guide - Track deployment health and performance
- Pruning Guide - Optimize storage with data pruning

