Thread: relid and relname

relid and relname

From
Edson Vilhena de Carvalho
Date:
Hi, I'm a new guy from Portugal

Can anyone tell me what is a relid, a relname and
schemaname data outputs resulting from the SQL: select
* from pg_stat_all_tables;

There are also other data outputs that I don´t
understand but they are probably related:
indexrelid (oid)
indexrelname (name)

I know what they types mean but would like to know to
what it refers


Tank very much
Edson Carvalho


__________________________________________________
Converse com seus amigos em tempo real com o Yahoo! Messenger
http://br.download.yahoo.com/messenger/

Re: relid and relname

From
Michael Fuhr
Date:
On Thu, Mar 24, 2005 at 11:01:23PM -0300, Edson Vilhena de Carvalho wrote:

> Hi, I'm a new guy from Portugal

Bem-vindo!

> Can anyone tell me what is a relid, a relname and
> schemaname data outputs resulting from the SQL: select
> * from pg_stat_all_tables;

relid = object ID (oid) of the relation (table)
relname = name of the relation (table)
schemaname = name of the relation's (table's) schema

In the system catalogs "relation" doesn't always refer to a table,
but in pg_stat_all_tables it does (pg_stat_all_tables is a view
that shows only tables).

See the "Data Definition" chapter in the documentation for more
information about tables and schemas.

http://www.postgresql.org/docs/8.0/static/ddl.html

> There are also other data outputs that I don't
> understand but they are probably related:
> indexrelid (oid)
> indexrelname (name)

indexrelid = object ID (oid) of the index
indexrelname = name of the index

See the "Indexes" chapter in the documentation for more information
about indexes.

http://www.postgresql.org/docs/8.0/static/indexes.html

Studying the "System Catalogs" chapter might also be useful.

http://www.postgresql.org/docs/8.0/static/catalogs.html

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Re: relid and relname

From
Tom Lane
Date:
Michael Fuhr <mike@fuhr.org> writes:
> On Thu, Mar 24, 2005 at 11:01:23PM -0300, Edson Vilhena de Carvalho wrote:
>> Can anyone tell me what is a relid, a relname and
>> schemaname data outputs resulting from the SQL: select
>> * from pg_stat_all_tables;

> relid = object ID (oid) of the relation (table)

More specifically, it's the OID of the pg_class row for the table.
So you can join the relid from that view to pg_class.oid to find
out more about the table.

> In the system catalogs "relation" doesn't always refer to a table,
> but in pg_stat_all_tables it does (pg_stat_all_tables is a view
> that shows only tables).

We really define "relation" as "anything that has a pg_class entry";
this includes tables, indexes, views, composite types, and some other
weirder cases.  Some but not all of these objects have associated disk
files.

            regards, tom lane