Optimize Database Relationships, Reduce Complexity

Customer: AI | Published: 14.11.2025
Бюджет: 250 $

My Java code is solid, yet the database layer is a mess. The current set-up of foreign keys and join tables produces N+1 queries, accidental cartesian products, and overall O(n²) performance where simple reads should be near-linear. I need the database relationships fixed—clean ER design, proper indexing, and refactored entity mappings—so common operations no longer grind to a halt. The stack is plain Java (Java 17, Spring Boot, Hibernate/JPA) on MySQL 8; no other frameworks are hiding in the background. Feel free to introduce smarter join tables, composite keys, or a bit of denormalisation if it truly helps. What matters is getting the Big-O back under control without breaking existing REST endpoints. Deliverables • Corrected ER diagram plus a migration script (SQL, Flyway, or Liquibase) that runs without data loss. • Updated Java entity classes and repositories that compile cleanly. • A short benchmark or explanation demonstrating the improved complexity or concrete query-time reduction. Acceptance criteria • CRUD and reporting endpoints still respond as before. • Core queries run in ≤ O(n log n) for realistic data volumes. • All existing Maven tests pass after the refactor. If untangling database relationships and squeezing out every millisecond is your thing, let’s do it.