There is such a need:
There are multiple tables on the server, and they all have associated keys content-id.
The front-end issues an Ajax request, and the back-end mysql performs a join query on multiple tables based on the content-id. PHP outputs json, and then the front-end parses and renders the json.
The front-end instead issues multiple Ajax requests, and the back-end queries each table. Each ajax request only corresponds to one table, and joins are no longer performed. PHP outputs multiple json, and then the front-end parses and renders the json.
Supplementary table structure:
The query of all tables is very simple:
The previous method is just one query:
select * from tableA join tableB on tableB.id = tableA.id ...(可能有多个JOIN)... where id = 5;
The method to be changed to, as many tables as the previous method, this method will have as many Ajax requests, and as many queries as there will be:
select * from tableA where id = 5; select * from tableB where id = 5; select * from tableC where id = 5;
Which solution is better?