I am making a programme that needs to have a global search function. So for an example: A user puts a string in a search field and hits a button. The button has to trigger a function that searches through all my tables and columns (about 20 tables in my db) and find the row(s) containing the string and return them.
The problem is, what is the best way performance-wise to do this? At the moment I am thinking about a select statement per table (select * from table where column like '%searchstring%' OR like '%searchstring%' ...). This will make about 20 select-statements, I don't know how fast this would be when I would put it in a for-loop.
Any suggestions and ideas are welcome!
PS: I am using PHP 7 and mysql in trying to achieve this.
Other answers I have found didn't give me enough info to my liking.