473,414 Members | 1,626 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,414 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 5326
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.