473,396 Members | 1,775 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,396 software developers and data experts.

measuring disk usage of records

We've had a chance to talk to some of our competitors who have recently gone
out of business. One of the major failings that contributed to their
collapse was not accurately understanding how much disk space and bandwidth
they were using up. Therefore, they often lost money unexpectedly which, as
most of you know, is not sustainable.

Therefore, we'd like to avoid falling into the same trap and get a good
understanding of how much storage space our customer's data is actually
using.

Here's the problem... A customer's data may be scattered across multiple
tables. Some customers have X,000 records in table A, some have Y,000
records in table B and etc. There's no way it can be as simple as saying
"database takes X GB for Y customers so usage is X/Y"

Does anyone have any suggestions that can help me to get access to this
information?

Matthew Nuzum | ISPs: Make $200 - $5,000 per referral by
www.followers.net | recomending Elite CMS to your customers!
ma**@followers.net | http://www.followers.net/isp

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #1
6 2532
Use contrib/dbsize, then you'll be able to

select relation_size('<table_name>');
select database_size('<database_name>');

Answers come back in bytes....

If the customer records are mixed with different customer
data in the same tables, it's a bit more complicated.

Matthew Nuzum wrote:
Therefore, we'd like to avoid falling into the same trap and get a good
understanding of how much storage space our customer's data is actually
using.

Here's the problem... A customer's data may be scattered across multiple
tables. Some customers have X,000 records in table A, some have Y,000
records in table B and etc. There's no way it can be as simple as saying
"database takes X GB for Y customers so usage is X/Y"

Does anyone have any suggestions that can help me to get access to this
information?


--
P. J. "Josh" Rovero Sonalysts, Inc.
Email: ro****@sonalysts.com www.sonalysts.com 215 Parkway North
Work: (860)326-3671 or 442-4355 Waterford CT 06385
************************************************** *********************
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #2
Thanks for the very quick reply... I didn't know about the dbsize stuff,
they may help. Unfortunately, the records are mixed together.

I may have to use some judicious estimating... I'm just wondering if there's
something more scientific.

Matthew Nuzum | ISPs: Make $200 - $5,000 per referral by
www.followers.net | recomending Elite CMS to your customers!
ma**@followers.net | http://www.followers.net/isp
-----Original Message-----
From: pg*****************@postgresql.org
[mailto:pg*****************@postgresql.org] On Behalf Of P.J. "Josh" Rovero
Sent: Wednesday, December 31, 2003 4:20 PM
To: Matthew Nuzum
Cc: pg***********@postgresql.org
Subject: Re: [GENERAL] measuring disk usage of records

Use contrib/dbsize, then you'll be able to

select relation_size('<table_name>');
select database_size('<database_name>');

Answers come back in bytes....

If the customer records are mixed with different customer
data in the same tables, it's a bit more complicated.

Matthew Nuzum wrote:
Therefore, we'd like to avoid falling into the same trap and get a good
understanding of how much storage space our customer's data is actually
using.

Here's the problem... A customer's data may be scattered across multiple
tables. Some customers have X,000 records in table A, some have Y,000
records in table B and etc. There's no way it can be as simple as saying
"database takes X GB for Y customers so usage is X/Y"

Does anyone have any suggestions that can help me to get access to this
information?


--
P. J. "Josh" Rovero Sonalysts, Inc.
Email: ro****@sonalysts.com www.sonalysts.com 215 Parkway North
Work: (860)326-3671 or 442-4355 Waterford CT 06385
************************************************** *********************
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #3
> Thanks for the very quick reply... I didn't know about the dbsize stuff,
they may help. Unfortunately, the records are mixed together.


If user tables are grouped by schema, you should be able to pull the
dbsize data by schema.

That raises an interesting question. Can pg be configured so
that user tables MUST be in user schemas, i.e., nobody can put tables
in the PUBLIC schema?
--
Mike Nolan

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #4


On Wed, 31 Dec 2003, Mike Nolan wrote:
That raises an interesting question. Can pg be configured so
that user tables MUST be in user schemas, i.e., nobody can put tables
in the PUBLIC schema?


Sure, you can simply drop the public schema, or "revoke all on schema
public from public";

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #5
"Matthew Nuzum" <co****@bearfruit.org> writes:
Thanks for the very quick reply... I didn't know about the dbsize stuff,
they may help. Unfortunately, the records are mixed together.


When measuring the on-disk size of a table, don't forget to include its
indexes and its toast table (and the toast table's index).

If you are using large objects, you'll also need to think sbout charging
for the space occupied by pg_largeobject.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #6
If you have a language installed (like pl/pgsql), then dropping the public
schema also drops the language. Ouch.

Maybe there is a solution to that one though...

John Sidney-Woollett

Kris Jurka said:


On Wed, 31 Dec 2003, Mike Nolan wrote:
That raises an interesting question. Can pg be configured so
that user tables MUST be in user schemas, i.e., nobody can put tables
in the PUBLIC schema?


Sure, you can simply drop the public schema, or "revoke all on schema
public from public";

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Peter Mount | last post by:
Hello Are there any good open source examples (or tutorials) for developing jsp pages to display web stats (like number of hits etc) and disk usage for a web site? I'm currently using JSP 2 with...
0
by: Rob Baxter | last post by:
I have a linux server which is hosting several very large (~20GB) databases. In order to save some disk space I dropped an index on one of the larger (InnoDB) tables because it is no longer needed....
3
by: Dan | last post by:
First, I'm sorry if this question has been asked too many times. I'm new to this news group. The question has to do with the use of popup windows in a web page. I have heard that popup windows...
1
by: Gh! | last post by:
How can I see how much disk space is being occupied by an InnoDB table? Looking into /var/lib/mysql doesn't seem to work anymore for InnoDB tables. Please tell also if there is a way to see how...
1
by: Kovan Akrei | last post by:
Hi, I have a multithreaded console program package. I would like to check it's peak memory usage. When I check the cmd windows process in task manager I allayes get something like 6 or 7 Mb, but I...
2
by: rubenqba | last post by:
Hi: Somebody knows how I can obtain disk space usage and the space that left in disk.
12
by: Sankar | last post by:
Dear all, I am programming in Linux , wherein I need to know a couple of things. 1) Does an API exist that can copy file onto another file ( an API equivalent of 'cp') ? 2) Is there an API...
1
by: runway27 | last post by:
hi i have mysql database installed on the main webserver and i use a pc through the lan. i have couple of tables in different databases. my question is using php and mysql methods can i write a...
3
by: dicoy | last post by:
Hi, I'm using VS 2005 and C# to make a website. I got a page that exports my report to an xls file (first reading a template, then poulating all the fields, then saving it to another file and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.