Querying problem into MySQL DB

Hi, can I ask some help,I have problem every time I will query data in my database and have many records (5000) will be returned or meets my query statement,my webpage will get “Not Responding” after it,it will load the data my page.but how can I prevent this not to get Not Responding during querying the data.

Thank you in advance.

There seems to be a lack of context in your post, which makes it difficult for us to give you a solution. What sort of data are you fetching? Is it possible for you to paginate this data, or employ an infinite scrolling mechanism? And also, how are you fetching this data (language and API)? Does the database API you’re using support the binding of results so that you can iterate through them, rather than loading everything into memory at once?

Providing details about your setup is very useful in not only finding a solution to your problems, but also finding the right solution to your problems.