How can multi-table federated queries be efficient?

the company"s product tables currently have 3, and there may be 20 + in the future, and the amount of data varies from tens of thousands to millions, each of which needs to be maintained separately and cannot be merged together. At present, I want to combine all tables for fuzzy query, how to write sql to build the index the fastest?
table A:
id:1, pn:max12389531,
id:2, pn:max12389698,
id:3, pn:max12389a59,

table B:
id:1, pn:max12389984,
id:2, pn:max12389124,
id:3, pn:max12389a59,

table C:
id:1, pn:max12389asd,
id:2, pn:max12389c58,
id:3, pn:max12389a95,

Mar.23,2021

1. To write SQL, you can first where the index field. For example, if status is a table index, then where status = 1 and xxx (fuzzy search)
2. If it is still slow, it is recommended to build a table, write some frequently queried data into it, and then write a script to update it regularly

.
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-1b391ab-2c176.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-1b391ab-2c176.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?