2013-05-10 56 views

回答

2

試試這個SQL

SELECT * FROM pg_indexes WHERE tablename = 'mytable'; 
+0

對不起,已更新! – Raptor 2013-05-10 09:44:42

1

psql使用\d命令:

 
postgres=> create table foo (id integer not null primary key, some_data varchar(20)); 
CREATE TABLE 
postgres=> create index foo_data_idx on foo (some_data); 
CREATE INDEX 
postgres=> \d+ foo 
            Table "public.foo" 
    Column |   Type   | Modifiers | Storage | Stats target | Description 
-----------+-----------------------+-----------+----------+--------------+------------ 
id  | integer    | not null | plain |    | 
some_data | character varying(20) |   | extended |    | 
Indexes: 
    "foo_pkey" PRIMARY KEY, btree (id) 
    "foo_data_idx" btree (some_data) 
Has OIDs: no 


postgres=> 

其他SQL工具必須顯示該信息的其他方式。

相關問題