I would like to know how much data was retrieve from the database in a query. It does not need to be exact (+/- 20% is ok)
some ways that it could be done:
- memory_get_usage() -> diff the value before and after the query. Could be problematic since memory can also change by other stuff changing in the meanwhile.
- strlen(json_encode($result)) -> will double the memory usage.
- recursively going through the result and calling str len on all attributes (could be slow)
Is there some more straightforward way to get the size of the result variable?