Query amount of storage consumed by a User

Asked

Viewed 31 times

1

Good morning,

I’m having trouble checking the amount of disk a person consumed.

This was the query built, seeing several sites:

SELECT table_name AS 'Nome da tabela', 
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS 'Tamanho'
FROM information_schema.tables 
WHERE table_name in 
('categories', 'item_orders', 'losses', 'orders', 'product_options', 'products', 'stock_options') 
ORDER BY data_length;

It’s a little closer to what I need, with this query I can get the total of each table, but I can’t filter what each user consumed from each table.

Each table has a column called "user_id" to link with the user, what I am not able to do, is to fit this user_id to pick only the consumption of a specific user.

I know this isn’t really going to take everything that the person consumed, but I wanted to start by taking at least the most raw of the data.

I’m using Laravel and Mysql on the back.

  • You think the DBMS only uses this as storage space? From what I understand in each table you have records of multiple users so this simple calculation is not enough.

  • I know there’s a lot more behind it to discover the storage consumed, what I’m trying to figure out is how to get the data from just one user for the calculation

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.