I’ve been contemplating this question as a develop visualizations for large sets of data in my mySQL database.
My current code runs a php SQL query when the page loads, converts it to JSON, and stores it in a Javascript variable for later use by d3 to visualize.
During visualization, I need to use that data, but also filter out results or perform some sort of quanitizing or binning.
Is it better to run multiple SQL queries in php as the page loads and store the results into multiple Javascript variables (hence letting SQL do the work)
or…
Do I continue what I’m doing, and run through the data in Javascript with for loops, pulling out the filtered data I need.
Thanks!
Use SQL to do the work it should make for a more responsive app and is the “right” place for it IMO. Data layer as opposed to presentation layer sort of thing.