mysql - how to limit user storage space php -


I can not understand the best way to limit the user's storage space on my php based app but I found this problem There is not an optimal way of handling. In response to that question, a user is suggested to run a MySQL SUM command to get the location that is currently using. Is it efficient? What do other people usually do?

In my case involves storing images for users, images are loaded on a cloud storage provider and I keep a record of the file size and name in my local database. Suppose a user's maximum placement is 10 GB. If each image is 300 KB after compression, then this will be ~ 33,000 images per user. If there are 1,000 users, then there will be ~ 33,000,000 images and thus there will be 33,000,000 rows in the table, suggesting that when many lines of the line are considered, the command is slow.

Another option I thought was that whenever any image is uploaded or deleted, the counter value decreases and decreases, but it may be stability and synchronized problems Hm ... < / P>

I think your solution will be to reduce the # consultant and country value # Slaves can run a cronbojob for queries of the database and can synchronize the values ​​at certain times ( Receive When you can run the script to maintain your database). I am using this kind of thing now, so far it works well.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -