Am Montag, 19. September 2005 17:28 schrieb Robert Klemme:
> You could do reports like
>
> select user, count(*)
> from your_table
>
> to see which user takes up how much space of the table.  If you
> combine this with information about the whole table's size you can
> even calculate MB a certain user uses.

But this would be quite inexact. Assume there are several VARCHAR columns that 
may have 1000 characters, but the values stored are only a few characters 
long. The users would not understand why they reached their limit although 
they entered only short texts.

My idea was to use triggers for all the tables that calculate the usage of the 
currently modified record and store this value in a special table. This would 
be something like

CREATE TRIGGER trg_update FOR <table> AFTER UPDATE EXECUTE (
UPDATE users SET db_usage = db_usage - :OLD.size +
:NEW.size WHERE user_id = :OLD.user_id;)

Is there a way to dynamically calculate the size of a record? In this case 
something like size (:NEW)? Or can I pass :NEW and :OLD to a dbproc?

Best regards,
Ralf.

-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to