Обсуждение: Question about PostgreSQL Metadata

Поиск
Список
Период
Сортировка

Question about PostgreSQL Metadata

От
"Lane Van Ingen"
Дата:
I am using version 8.0.3 on Windows 2003.

I would like to get a report out of PostgreSQL like the one below, EXCEPT
that I would like to associate a table name with the indexes this query
pulls
from pg_class.

Does anyone know how to do this?

-------- report query -------------
select relname,
  relpages,
  reltuples,
  relpages,
  relnatts
  from pg_class
  where relkind = 'i'
  and relname not like 'sql_%'
  and relname not like 'pg_%'
order by 1;



Re: Question about PostgreSQL Metadata

От
Tom Lane
Дата:
"Lane Van Ingen" <lvaningen@esncc.com> writes:
> I would like to associate a table name with the indexes this query
> pulls from pg_class.

You have to join against pg_index and then back to pg_class.
See the system catalogs documentation for your PG version, eg
http://www.postgresql.org/docs/8.0/static/catalogs.html

            regards, tom lane