The place you should do your filtering is on the server-side, via the SQL query. If this requires page-interaction, use
AJAX [
^] to refresh the search area when selections are made.
SQL is designed for searching, sorting, aggregating, and such. It will do a far better job than you and do it faster.