Re: remove indexes on a column?
От | Tom Lane |
---|---|
Тема | Re: remove indexes on a column? |
Дата | |
Msg-id | 16134.1221022900@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: remove indexes on a column? (Vance Maverick <vmaverick@pgp.com>) |
Список | pgsql-general |
Vance Maverick <vmaverick@pgp.com> writes: > Perfect! Looks like I can get the names of the existing indexes by > doing > SELECT dep.relname > FROM pg_attribute col, pg_class tab, pg_depend pd, pg_class dep > WHERE tab.relname = 'mytable' > AND col.attname = 'mycolumn' > AND col.attrelid = tab.oid > AND pd.refobjid = tab.oid > AND pd.refobjsubid = col.attnum > AND pd.objid = dep.oid > AND dep.relkind = 'i'; Too tired/lazy to check right now, but you should also look into what the pg_depend representation is for constraints: I have a feeling that a unique or primary key constraint yields a pg_depend structure with an indirect linkage through a pg_constraint entry. Also, the above query doesn't seem very schema-safe: what if there are multiple tables named mytable? Personally I'd try something like tab.oid = 'mytable'::regclass instead of the relname test. regards, tom lane
В списке pgsql-general по дате отправления: