Thread: Table size

Table size

From
lak
Date:
I have two questions.
How can I enter comments into a table? Where the comments are stored?

In  psql How can I know the size of a single table?

If know pls replay.
Thanks i advance



Re: Table size

From
"Pavan Deolasee"
Date:
On Fri, Mar 21, 2008 at 3:03 PM, lak <lakindia89@gmail.com> wrote:
> I have two questions.
>  How can I enter comments into a table? Where the comments are stored?
>

What do you mean by comments in a table ?

>  In  psql How can I know the size of a single table?
>

Select pg_relation_size('mytable');


Thanks,
Pavan


--
Pavan Deolasee
EnterpriseDB http://www.enterprisedb.com

Re: Table size

From
Shane Ambler
Date:
Pavan Deolasee wrote:
> On Fri, Mar 21, 2008 at 3:03 PM, lak <lakindia89@gmail.com> wrote:
>> I have two questions.
>>  How can I enter comments into a table? Where the comments are stored?
>>
>
> What do you mean by comments in a table ?

I think what you are referring to is detailed in
http://www.postgresql.org/docs/8.3/interactive/sql-comment.html

The comments are stored in pg_description (and pg_shdescription) but you
should use the comment command instead of manipulating it manually.

>>  In  psql How can I know the size of a single table?
>>
>
> Select pg_relation_size('mytable');
>
>
> Thanks,
> Pavan
>
>


--

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz

Re: Table size

From
Erik Jones
Date:
On Mar 21, 2008, at 4:33 AM, lak wrote:

> I have two questions.
> How can I enter comments into a table? Where the comments are stored?

Comments are created with the COMMENT sql command and, in pg, are
stored in pg_description.

> In  psql How can I know the size of a single table?


pg_relation_size()

Often called as pg_size_pretty(pg_relation_size('some_table')) for
more readable output.

Use pg_total_relation_size() for the size with indexes and toast tables.

Erik Jones

DBA | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com




Re: Table size

From
Craig Ringer
Date:
lak wrote:
> I have two questions.
> How can I enter comments into a table? Where the comments are stored?
>
Assuming you want comments on the table schema definitions, use COMMENT ON.

CREATE TABLE sometable (
-- definition
);

COMMENT ON TABLE sometable IS "This is a table";

If that's not what you're after, you might need to be more specific.

--
Craig Ringer


Re: Table size

From
Andreas Kretschmer
Date:
Pavan Deolasee <pavan.deolasee@gmail.com> schrieb:

> On Fri, Mar 21, 2008 at 3:03 PM, lak <lakindia89@gmail.com> wrote:
> > I have two questions.
> >  How can I enter comments into a table? Where the comments are stored?
> >
>
> What do you mean by comments in a table ?

Comments on a table or a column or on other objects.

Comments on objects can set by:

comment on ... is 'comment';

Please read within psql the output from '\h comment' to learn more.
Comments are stored in pg_description:
http://www.postgresql.org/docs/current/interactive/catalog-pg-description.html

>
> >  In  psql How can I know the size of a single table?
> >
>
> Select pg_relation_size('mytable');

More about that:
http://andreas.scherbaum.la/blog/archives/282-table-size,-database-size.html


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."    (unknow)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

Re: Table size

From
"Pavan Deolasee"
Date:
On Fri, Mar 21, 2008 at 10:12 PM, Andreas Kretschmer
<akretschmer@spamfence.net> wrote:

>
>  Comments on objects can set by:
>
>  comment on ... is 'comment';
>

Oh cool.. I did not such facility exists.

Thanks,
Pavan


--
Pavan Deolasee
EnterpriseDB http://www.enterprisedb.com

Re: Table size

From
"Pavan Deolasee"
Date:
On Fri, Mar 21, 2008 at 10:25 PM, Pavan Deolasee
<pavan.deolasee@gmail.com> wrote:

>
>  Oh cool.. I did not such facility exists.
>


I meant, "I did not know such facility exists"

Thanks,
Pavan


--
Pavan Deolasee
EnterpriseDB http://www.enterprisedb.com

Re: Table size

From
"Webb Sprague"
Date:
>  I meant, "I did not know such facility exists"

When you use pgautodoc, it automatically grabs those comments and puts
them in the web page it crreates...  more coolness!