Table size

Started by lakabout 18 years ago9 messagesgeneral
Jump to latest
#1lak
lakindia89@gmail.com

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

#2Pavan Deolasee
pavan.deolasee@gmail.com
In reply to: lak (#1)
Re: Table size

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

#3Shane Ambler
pgsql@Sheeky.Biz
In reply to: Pavan Deolasee (#2)
Re: Table size

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

#4Erik Jones
erik@myemma.com
In reply to: lak (#1)
Re: Table size

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

#5Craig Ringer
craig@2ndquadrant.com
In reply to: lak (#1)
Re: Table size

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

#6Andreas Kretschmer
akretschmer@spamfence.net
In reply to: Pavan Deolasee (#2)
Re: Table size

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�

#7Pavan Deolasee
pavan.deolasee@gmail.com
In reply to: Andreas Kretschmer (#6)
Re: Table size

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

#8Pavan Deolasee
pavan.deolasee@gmail.com
In reply to: Pavan Deolasee (#7)
Re: Table size

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

#9Webb Sprague
webb.sprague@gmail.com
In reply to: Pavan Deolasee (#8)
Re: Table size

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!