Обсуждение: Location of index information

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

Location of index information

От
Jim Beckstrom
Дата:
If the table names in a database are in pg_class.relname, where are the associated indexes, or where is this documented?

Thanks,
Jim

Re: Location of index information

От
Tom Lane
Дата:
Jim Beckstrom <jrbeckstrom@sbcglobal.net> writes:
> If the table names in a database are in pg_class.relname, where are the associated indexes, or where is this
documented?

The indexes have their own entries in pg_class.  The linkage between a
table and its indexes is made through entries in pg_index.  See the
system catalogs documentation for your release:
http://www.postgresql.org/docs/8.1/static/catalogs.html
(adjust link as needed --- although the basic stuff tends to remain
the same across releases, sometimes the details change)

            regards, tom lane

Re: Location of index information

От
Michael Glaesemann
Дата:
On Dec 8, 2005, at 8:25 , Jim Beckstrom wrote:

> If the table names in a database are in pg_class.relname, where are
> the associated indexes, or where is this documented?

http://www.postgresql.org/docs/current/interactive/index.html

VII. Internals 42. System Catalogs

Michael Glaesemann
grzm myrealbox com




Re: Location of index information

От
Michael Fuhr
Дата:
On Wed, Dec 07, 2005 at 03:25:57PM -0800, Jim Beckstrom wrote:
> If the table names in a database are in pg_class.relname, where
> are the associated indexes, or where is this documented?

Indexes have entries in various tables such as pg_class, pg_index,
and pg_attribute.  See "System Catalogs" in the documentation for
details; here's the latest version:

http://www.postgresql.org/docs/8.1/interactive/catalogs.html

If that doesn't help then please describe what information you're
after or what you're trying to do.

--
Michael Fuhr

Re: Location of index information

От
Jim Beckstrom
Дата:
Now that I have read the glossary for pg_index (thank you for the link),  there wouldn't be a php function available to do the selection of all of the indexes for a table, would there?

Jim


Tom Lane <tgl@sss.pgh.pa.us> wrote:
Jim Beckstrom writes:
> If the table names in a database are in pg_class.relname, where are the associated indexes, or where is this documented?

The indexes have their own entries in pg_class. The linkage between a
table and its indexes is made through entries in pg_index. See the
system catalogs documentation for your release:
http://www.postgresql.org/docs/8.1/static/catalogs.html
(adjust link as needed --- although the basic stuff tends to remain
the same across releases, sometimes the detail s change)

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Re: Location of index information

От
Tom Lane
Дата:
Jim Beckstrom <jrbeckstrom@sbcglobal.net> writes:
> Now that I have read the glossary for pg_index (thank you for the link),  there wouldn't be a php function available
todo the selection of all of the indexes for a table, would there? 

Dunno anything about PHP, but maybe the pg_indexes view would help you?
Or make your own view.

            regards, tom lane

Re: Location of index information

От
Jaime Casanova
Дата:
On 12/7/05, Jim Beckstrom <jrbeckstrom@sbcglobal.net> wrote:
> Now that I have read the glossary for pg_index (thank you for the link),
> there wouldn't be a php function available to do the selection of all of the
> indexes for a table, would there?
>
> Jim
>

if you execute psql with the -E option when you do \d table you will
get all sql you need to retrieve the information it shows...

then, you can copy and paste that sql to your php script or make a
view as tom suggest...

but in general i guess   select * from pg_views is a good point to start

--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)