Am fetching data from database i need to pass variable in my query.but am not getting how to pass variable in query
Do the JOIN in SQL, not with a client-side loop.  Cutting down on the number of round-trips to the server helps; cutting down on the number of queries to parse and execute helps, even though the resulting query is more complex.

But the real slowdown is not having the result of LOWER(REPLACE(suggestion,' ','')) as an indexed column in the table.