Since you are likely to pay only for the information that the customer explicitly pays you for storage, simply summarize the lengths of the fields that they explicitly give you. (Omit the internal fields such as business_id , service_level_id , permissions or something else.) Then refer to the storage requirements and calculate.
So, where B is the number of bytes required for all number fields, and there are 3 text fields txtA, txtB and txtC, for example:
select business_id, count(*) * B + sum(length(txtA) + length(txtB) + length(txtC)) as bytes from table where business_id={id};
But, as soon as you have enough data on your system, I suspect the request will be quite lengthy. It might be easier to simply tell your customers that you expose them to their โapproximateโ data warehouse. Use average_row_length * count(*) your lines and average_row_length * count(*) bit to account for your overhead.
svidgen
source share