473,320 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

limit database size

exoskeleton
104 100+
hi dear experts, i would like to know on how to limit the size the postgre database (ex. 10MB per database)? is there any configuration needed in phpadmin or in the php code?

pls help me dear experts...thank you
Jan 24 '07 #1
7 5321
michaelb
534 Expert 512MB
You cannot limit the size of the database - there's no such configuration parameter in PostgreSQL.
(And I suspect the reason is that most people never need it)

I suppose you can implement your own control, for example you can have a cron job that would check the size of database (using psql could be the easiest approach) and then do something, (shut down the server?) if database size exceeds some limit.

Expand|Select|Wrap|Line Numbers
  1.  
  2. select pg_database_size('dbname') ;
  3.  
Jan 24 '07 #2
exoskeleton
104 100+
thank you sir but i dont have any idea where to put that code...should i include it in a php file so everytime the client add a record and he reach his limit...the system will tell him that he cant process the transaction anymore because he already reach the limit.

is that it? only that code sir, just one line of code? please help any detailed coding ... please
Jan 25 '07 #3
exoskeleton
104 100+
You cannot limit the size of the database - there's no such configuration parameter in PostgreSQL.
(And I suspect the reason is that most people never need it)

I suppose you can implement your own control, for example you can have a cron job that would check the size of database (using psql could be the easiest approach) and then do something, (shut down the server?) if database size exceeds some limit.

Expand|Select|Wrap|Line Numbers
  1.  
  2. select pg_database_size('dbname') ;
  3.  
sir after this:

select pg_database_size('dbname') ;
...
...
..
..
..

any code after that please...i know that this is exactly what im looking for. of course pg_connect is still needed right before the select statement above...
Jan 25 '07 #4
michaelb
534 Expert 512MB
What to code next depends on which action you want to take.
Your options may vary from sending a warning email to the user to dropping the database.
I would try to avoid any drastic actions, which is hard to justify
(even if you deal with students who use a school server for their classes)
You can also establish a threshold and an action it entails; say if db size exceed 10mb you generate an email, but if it exceeds 100mb you also drop the database.

By the way, what type of authentication users have on this server, is it password, trust, anything else?
Jan 25 '07 #5
hi dear experts, i would like to know on how to limit the size the postgre database (ex. 10MB per database)? is there any configuration needed in phpadmin or in the php code?

pls help me dear experts...thank you
I can think of a number of ways to do this. The easiest is to us the tablespaces feature and stick each DB in it's own tablespace on a 10MB partition.
Jan 29 '07 #6
michaelb
534 Expert 512MB
If I understand correctly this approach involves management outside of database (creating a per-user disk partitions)
Also hard limits may be dangerous; unless the out-of-disk-space condition is now nadled better in the latest versions of Postgres running ot of space in the middle of transaction may corrupt the database.
Jan 30 '07 #7
In my opinion, the best option is this:
-every user gets a seperate db
-check the size of the databases in e.g. every 5 minutes.
-if the size of a db is larger then the user quota then take away the user's INSERT and CREATE permission. And store somewhere that this happened, then notify the user.
-If at the next check, the db size is under the quota, then give back the permissions.
Aug 20 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Gareth Tuckwell | last post by:
Does anyone if there is a limit on the number of fields or the number of tables in an Access97 database? My code suddenly won't compile after I have added a few fields in one table and I wonder...
2
by: steve | last post by:
I am setting up a huge database in mysql, and I get the above error in Linux. I believe it is related to the size of one of my tables, which is 4,294,966,772 bytes in size. Can someone help. How...
7
by: johnm | last post by:
We have a new CRM application that uses a DB2 7.2 database. Our users noted that the CRM application would not allow them to attach and store any documents over 2 meg in size. When asked, the...
1
by: Danny | last post by:
I have one person who uses an access database for his billing info, and now he is way up there, maybe 20 thousand records.. 1. is there a limit to the size of an access database? 2. this is...
4
by: bdotson | last post by:
Does anyone know the record limit for a single table in Access 97? I have a client who has over 800,000 records in one table. They are experiencing math problems and timeouts when running reports....
1
by: Jan | last post by:
Is there a 2GB size limit on Access2003/XP ? If so, is there an easy way to span across more than one MDB file?
1
by: orenbt | last post by:
Hi, I am new to SQL express and try to solve the 4GB size limitation. Is there a possibility to create a new database file every time I get to the limit? How can I do that with C#? how can I...
3
by: John Taylor | last post by:
Tried to find any reference to this on the Microsoft help pages but can't find any reference - maybe I'm just not smart enough to find it. However; I have been working on a membership database...
5
by: Chuck | last post by:
If the max size of an Access DB is about 2gb, and the DB is split, does each item have its own 2 gb limit or does the combined size of linked tables add to the size of the FE to get to the limit?...
5
by: bobh | last post by:
HI, I understand AccessXP file size has a 2 gig limit but I trying to understand the following I have a tab delimited data file that is 1.3 gigs big and I try to import it into an empty...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.