How to set DB max-size per user ?

Duboux

Verified User
Joined
Apr 20, 2007
Messages
251
I would like to give my users databases, since most free scritps use mysql these days...

But I heard that databases can slow down the server, so I can't place as many users on it, if they all have db's.. :(

So, I was wondering, if there was a maximum for the amount of mb a database can have, and if this can be settable per user..

eg, free db = 10mb.
And I can ask extra money for extra db-mb's..

One of my clients has a vbulletin forum, that uses 300mb db :eek:
 
I don't know of any way to limit mysql databases by amount of disk-space they take up; if I were you I'd ask on a mysql-specific forum.

Jeff
 
Some MySql way..
I guess MySql would need to be altered that it would standard add those limits to queries, which isn't my favorite thing to do.
http://dev.mysql.com/doc/refman/5.0/en/create-table.html said:
When you create a MyISAM table, MySQL uses the product of the MAX_ROWS and AVG_ROW_LENGTH options to decide how big the resulting table is. If you don't specify either option, the maximum size for a table is 256TB of data by default (4GB before MySQL 5.0.6)


Some Linux way..
http://www.thescripts.com/forum/post2329128-4.html said:
you can consider using a file system facilities (that is if you' running on a UNIX platform which has a support for per-user disk quota)

Provided that /dbdata is a quota-enabled partition you can try something like this:
  1. CREATE TABLESPACE dbspace LOCATION '/dbdata';
  2. CREATE DATABASE db_dbuser OWNER dbuser TABLESPACE dbspace;
See the Postgres manual, CREATE TABLESPACE and CREATE DATABASE for details.

I don't like this approach, because if you run out of disk space and cannot commit a transaction you may have to do some work to recover the database.


Some other way..
Run a cron that checks the database size of each user (database_size('dbname')) and send an email, or create a DA-ticket (which also sends an email) to the admin and if needed reseller.
An add to a logfile would also be nice, so people can see a page just like they can see their bandwith from the past months.
This way you could charge extra as if it was extra bandwith usage.
But then again, it would be nice if a user paid for a 50mb db, that he wouldn't get buggered by those emails, and that amount of mb for a db was settable per user, in DA.


Some sort of DA expansion way:
Like web and email size are re-checked every day, and also the db-size is known...
Uhh.. some addition to DA that has a max total DBs-size, just like max mb account size.
 
Which brings up an interesting question. Does DA by default use MyISAM tables?

Jeff
 
Back
Top