I have just seen Limiting table disk quota in MySQL by Shlomi
Noach, and I could not resist.
You can actually implement a disk quota using an updatable view
with the CHECK OPTION.
Instead of giving the user access to the table, you give access
to the view (at least for inserting, see the caveat at the end),
and you will get a genuine MySQL error when the limit is
reached.
drop table if exists logs;[Read more]
create table logs (t mediumtext) engine=innodb;
drop function if exists exceeded_logs_quota ;
create function exceeded_logs_quota()
returns boolean
deterministic
return (
select CASE
WHEN (DATA_LENGTH + INDEX_LENGTH) > (25*1024)
THEN TRUE ELSE FALSE
…