What is the best practice that provides the best performance?
I currently have a query with many LEFT JOIN that retrieves user and all of his data like friends, friend requests, etc:
SELECT `user`.`id` AS `user_id`, `user`.`name` AS `user_name`, `manager`.`id` AS `manager_id`, `competition`.`id` AS `manager_competition_id`, `competition`.`name` AS `manager_competition_name`, `competition`.`week` AS `manager_competition_week`, `country`.`id` AS `manager_competition_country_id`, `country`.`name` AS `manager_competition_country_name`, `club_template`.`id` AS `manager_club_template_id`, `club_template`.`name` AS `manager_club_template_name`, `club`.`id` AS `manager_club_id`, `club`.`name` AS `manager_club_name`, `club`.`ready` AS `manager_club_ready`, `friend`.`friend_id` AS `friend_id`, `friend_user`.`name` AS `friend_name` FROM `users` AS `user` LEFT JOIN `managers` AS `manager` ON `manager`.`user_id` = `user`.`id` LEFT JOIN `competitions` AS `competition` ON `competition`.`id` = `manager`.`competition_id` LEFT JOIN `countries` AS `country` ON `country`.`id` = `competition`.`country_id` LEFT JOIN `club_templates` AS `club_template` ON `club_template`.`id` = `manager`.`club_template_id` LEFT JOIN `clubs` AS `club` ON `club`.`id` = `manager`.`club_id` LEFT JOIN `friends` AS `friend` ON `friend`.`user_id` = `user`.`id` LEFT JOIN `users` AS `friend_user` ON `friend_user`.`id` = `friend`.`friend_id` WHERE `user`.`id` = 1
As you can see, this is a very big request. My reasoning was that it is better to have only one request that can be executed in one API request, for example ...
/api/users/1
... compared to multiple requests, each in its own API request, for example ...
/api/users/1 /api/users/1/friends /api/users/1/friend_requests /api/users/1/managers
But now I'm worried that since it has become such a huge request that it will actually hurt performance more than splitting it into separate API requests.
What will scale better?
Update
I changed the request to the full request. This is not a final request; I plan to add even more joins (or not, depends on the answer).
Each table has a PRIMARY KEY on id . All association columns ( competition_id , club_id , etc.) have a regular INDEX . The core of the database is InnoDB.