Report Handling Large Datasets in PHP Posted February 18, 2011 Why do so many records need to be at hand? I don't get it. If you have that many records being returned maybe u need some kind of pagination. It sounds like you want to filter thru the 10,000 records returned. Why not add these filters to your sql where clause and re-fetch the data in the background? Thanks for the reply. I will have 25 results per page to break it up. I really want to try and return the results using less resources. I figured that so many queries running at the same time with so many records in so many tables would really slow it down. My goal is to gauge for large amounts of traffic and have efficient code and queries to handle it fast. Do you think I am over thinking it? Perhaps my query could be optimized. SELECT table1.p_id, table1.r_name, table1.account_activated, table1.r_phone, table1.r_fax, table1.r_address_1, table1.r_address_2, table1.r_city, table1.r_postal, table1.r_state, table1.r_description, table1.r_genre_1, table1.r_genre_2, table1.r_genre_3, table1.r_genre_4, table1.r_genre_5, table1.r_date_added, table1.r_rate_store, table1.r_rate_store_total, table1.order_online, table1.online_delivery, table1.online_delivery_start, table1.online_delivery_end, table1.gift_certs, table1.RSS, table1.rewards_programs, table1.url, p_details.delivery, table1.r_lattitude, table1.r_longitude, ( 3959 * acos( cos( radians(40.745564) ) * cos( radians( r_lattitude ) ) * cos( radians( r_longitude ) - radians(-73.977736) ) + sin( radians(40.745564) ) * sin( radians( r_lattitude ) ) ) ) AS howfar FROM table1, p_details WHERE p_details.size = 1 and p_details.external = 1 and p_details.usb = 1 HAVING howfar <= 3 ORDER BY howfar would a join make this run faster?