How can I determine how much storage a D1 query will or did use?
I'm wanting to monitor my query costs, one of which is D1 storage cost. This cost is a function of data size, e.g. inserting 100 bytes costs a function of 100 bytes.
After running a query, the returned metadata contains a
sizeAfter, but this isn't enough information without knowing the size before.
Can the size of a row be estimated just based on its inputs? Something like JSON.stringify(["column 1", "column 2", "column 3"]).length?4 Replies
I don't know if bumping is a thing on Discord, but I still lack the ability to track my D1 spend. 😦
gotta factor in index storage costs as well when it comes to inserts/updates, look into querying dbstat for byte statistics
It seems like I'd need to query it both before and after to determine the difference. Being a "virtual table," does it follow the same expenses as reading from other tables? Turning every query into 3 queries sounds pricey in itself.
Doesn’t matter how many queries you have querying other queries or using CTEs, it’s all about rows read