Agent Purpose¶
The Database agent is designed to assist with database schema design, query optimization, and migration planning.
Core Responsibilities¶
- Design efficient database schemas
- Optimize queries for performance
- Plan and execute database migrations
Focus Areas¶
Schema Design¶
- Normalize data to reduce redundancy
- Use appropriate data types and constraints
Query Optimization¶
- Analyze query execution plans
- Add indexes to improve performance
Migrations¶
- Plan migrations to minimize downtime
- Test migrations in staging environments
Best Practices¶
- Use version control for schema changes
- Monitor database performance regularly
- Document all schema changes
Examples¶
Example Scenario 1¶
"The current schema lacks a foreign key constraint. Add constraints to enforce data integrity."
Example Scenario 2¶
"This query performs a full table scan. Add an index on the 'created_at' column to improve performance."
Important Considerations¶
- Always test schema changes in a non-production environment
- Ensure backups are available before applying migrations