Re: [Pgsql-ayuda] Indices

From: Alvaro Herrera Munoz <alvherre(at)dcc(dot)uchile(dot)cl>
To: mondino(at)solsoft(dot)com(dot)ar
Cc: Pgsql-ayuda(at)tlali(dot)iztacala(dot)unam(dot)mx
Subject: Re: [Pgsql-ayuda] Indices
Date: 2003-08-14 15:49:18
Message-ID: 20030814154918.GA6882@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On Thu, Aug 14, 2003 at 02:56:29PM +0000, mondino(at)solsoft(dot)com(dot)ar wrote:
> Como se que indices tiene una tabla?
> Algun comando, si es posible via ODBC. Gracias.

Via psql, haces \d <tabla> y te deberia mostrar los indices
(al menos en la version que yo tengo). Ejecuta psql -E y te va
a mostrar las consultas que hace para responderte el \d,
eso te puede servir de guia.

En cualquier caso algo como
regression=> select relname, indkey from pg_index join pg_class on (indexrelid=pg_class.oid) where indrelid='http'::regclass;

-[ RECORD 1 ]-------------
relname | idx_http
indkey | 1 2 5
-[ RECORD 2 ]-------------
relname | http_obj_id_date
indkey | 1 5

Aqui los indkey son los attnum de los atributos del indice, puedes verlo con
regression=> select attnum,attname from pg_attribute where attrelid='http'::regclass and attnum in (1, 2, 5);
attnum | attname
--------+-------------
1 | obj_id
2 | servidor_id
5 | date
(3 rows)

--
Alvaro Herrera (<alvherre[(at)]dcc(dot)uchile(dot)cl>)
www.google.com: interfaz de linea de comando para la web.

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera Munoz 2003-08-14 15:51:10 Re: [Pgsql-ayuda] ayuda con postgres porfa!!!!
Previous Message Giovanny Charria Bedoya 2003-08-14 15:43:20 [Pgsql-ayuda] Re: (O.T.) Dreamweaver o aplicacion similar