There is a need: there are multiple tables on the server, all of which are related to the joint key content-id. Previous practice: the front-end sends an Ajax request. the back-end mysql performs join queries on multiple tables based on the content-id, and php outputs json. then the front-end parses and renders the json. But some colleagues said that they have such a requirement:
There are multiple tables on the server, all of which are related to the link key content-id.
Previous practices:
The front-end sends an Ajax request. the back-end mysql performs join queries on multiple tables based on the content-id. php outputs json and the front-end parses and renders the json.
However, some colleagues say this is too performance consuming and should be changed to this:
The front-end sends multiple Ajax requests, and the backend queries each table. each ajax request corresponds to only one table and does not join any more. php outputs multiple json files, then the front-end will parse and render the json.
Supplement Table structure:
Query for all tables is very simple:
In the previous method, a query is performed:
Select * from tableA join tableB on tableB. id = tableA. id... (multiple joins may exist)... where id = 5;
The method to be changed. for how many tables are there in the preceding method, the method has the number of Ajax requests and the number of queries:
Select * from tableA where id = 5; select * from tableB where id = 5; select * from tableC where id = 5;
Which solution is better?