How to correlate query data combinations in the service layer?

the following sql statement is known:

select * from a left join b on a.id=b.id
where a.x=1 and b.yroom2;

this is a very common join table query in the db layer, but if the db layer does not allow the join table query operation, it can only be queried by querying a single table separately, and the query results can be combined in the service layer.

it is known that there is a large amount of data in the aformab table, so there is no better solution.

sort out:
1. You cannot do join table queries at the db layer.
2. Both tables have query conditions
3. Query results require data combination of two tables
4. Both tables have a large amount of data

Apr.05,2021

1: add an appropriate index according to the query field
2: in the case of effective use of the index, find out the data in table a, and then go to table b according to the data found in table a to obtain data in batches. If a finds a large amount of data, you can check it in batches.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf955d-30eb4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf955d-30eb4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?