Unix Technical Forum

table size and storage location

This is a discussion on table size and storage location within the Pgsql General forums, part of the PostgreSQL category; --> Hi, I have two questions: 1) how do I find out the size, in MB, of a particular table ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 12:22 AM
chuckee
 
Posts: n/a
Default table size and storage location


Hi,
I have two questions:

1) how do I find out the size, in MB, of a particular table (called
'capture' in this case).
I tried entering the SQL query SELECT (pg_tablespace_size('capture'));
The result was the following:
ERROR: tablespace "capture" does not exist

2) how do I find out where the actual files for the database are stored on
my system?
Where is the default storage location?

Thanks!
Charlie
--
View this message in context: http://www.nabble.com/table-size-and...p16230697.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


-
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 12:22 AM
paul rivers
 
Posts: n/a
Default Re: table size and storage location

chuckee wrote:
> 1) how do I find out the size, in MB, of a particular table (called
> 'capture' in this case).
> I tried entering the SQL query SELECT (pg_tablespace_size('capture'));
> The result was the following:
> ERROR: tablespace "capture" does not exist
>


You're looking for pg_relation_size('capture') or
pg_total_relation_size('capture'). A tablespace is a named location for
creating objects.


> 2) how do I find out where the actual files for the database are stored on
> my system?
> Where is the default storage location?
>


The complete story is laid out in the docs here:
http://www.postgresql.org/docs/8.3/i...le-layout.html


HTH,
Paul


-
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 12:23 AM
Andrej Ricnik-Bay
 
Posts: n/a
Default Re: table size and storage location

On 25/03/2008, chuckee <mi6@orcon.net.nz> wrote:

> Thanks but I still get the error 'ERROR: relation "capture" does not exist'
> when trying these two alternative functions you mention above. There is
> definitely a table called 'capture' in my database!

Are you sure you're connected to the right database
when running that?



--
Please don't top post, and don't use HTML e-Mail :} Make your quotes concise.

http://www.american.edu/econ/notes/htmlmail.htm

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-10-2008, 12:23 AM
paul rivers
 
Posts: n/a
Default Re: table size and storage location

chuckee wrote:
> paul rivers-2 wrote:
>
>> chuckee wrote:
>>
>>> 1) how do I find out the size, in MB, of a particular table (called
>>> 'capture' in this case).
>>> I tried entering the SQL query SELECT (pg_tablespace_size('capture'));
>>> The result was the following:
>>> ERROR: tablespace "capture" does not exist
>>>
>>>

>> You're looking for pg_relation_size('capture') or
>> pg_total_relation_size('capture'). A tablespace is a named location for
>> creating objects.
>>
>>
>>

>
> Thanks but I still get the error 'ERROR: relation "capture" does not exist'
> when trying these two alternative functions you mention above. There is
> definitely a table called 'capture' in my database!
>


Is the schema for capture in your search_path? If not, include that in
the function call: function('yourschema.capture'). Otherwise, what
version are you on? I don't know when these functions were added;
perhaps you're stuck doing the math yourself on page counts in pg_class.

Paul




--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-10-2008, 12:23 AM
chuckee
 
Posts: n/a
Default Re: table size and storage location



paul rivers-2 wrote:
>
> chuckee wrote:
>> 1) how do I find out the size, in MB, of a particular table (called
>> 'capture' in this case).
>> I tried entering the SQL query SELECT (pg_tablespace_size('capture'));
>> The result was the following:
>> ERROR: tablespace "capture" does not exist
>>

>
> You're looking for pg_relation_size('capture') or
> pg_total_relation_size('capture'). A tablespace is a named location for
> creating objects.
>
>


Thanks but I still get the error 'ERROR: relation "capture" does not exist'
when trying these two alternative functions you mention above. There is
definitely a table called 'capture' in my database!
--
View this message in context: http://www.nabble.com/table-size-and...p16249922.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-10-2008, 12:23 AM
Tom Lane
 
Posts: n/a
Default Re: table size and storage location

"Andrej Ricnik-Bay" <andrej.groups@gmail.com> writes:
> On 25/03/2008, chuckee <mi6@orcon.net.nz> wrote:
>> Thanks but I still get the error 'ERROR: relation "capture" does not exist'
>> when trying these two alternative functions you mention above. There is
>> definitely a table called 'capture' in my database!


> Are you sure you're connected to the right database
> when running that?


Case-sensitivity is the other standard gotcha ... maybe the table is
really named "Capture" or something like that?

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:51 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com