in reply to bind_columns OR fetchall_arrayref

If you've indexed the 'fee' column, returning just 4,000 rows from mysql will happen a lot faster than any client pc can render, and if you don't specify every dimension of the html table, it will take even longer.

If you aren't absolutely required by the project spec to produce specfically an html table, then you might consider using pre-formatted output instead:

<pre> results here </pre>
You just pad in between columns with spaces. If the values in the columns have varying numbers of digits, it's pretty easy to pad witha variable number of spaces using the same kind of regex for returning fixed-length numbers with leading zeros.

The browser will render the pre-formatted output in real time.

If you are absolutely bound to use an html table, at the very least you could use css for the td-element so that you don't have to send a new font tag in every table element.

Forget that fear of gravity,
Get a little savagery in your life.