Based on the comments you eventually provided the query that you are running.
select * from table
You also said that you have "a huge ammount of rows". This should be simple enough for you to understand why it takes forever to transfer to the box querying your database.
And also, just because your query runs fast, you still have to deal with network limitations. Plus, once you actually receive the result, hypothetically, if you were using an ORM for instance, you could find that hydration of the result set adds complexity and time to your request.
Overall, you answered this question yourself. Don't do a select * from table
where the table is "enormous".
You should look at adding limits and offsets to your query and only select the rows that you actually need.
Also, "huge" is extremely subjective. To me, a large table is about 10million rows. But to someone else 10million is pretty small. I wouldn't even like to put a number on what a huge table might be.