X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 112ECD1B1A1 for ; Thu, 10 Jun 2004 05:42:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00374-09 for ; Thu, 10 Jun 2004 08:42:02 +0000 (GMT) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id 44B98D1B192 for ; Thu, 10 Jun 2004 05:41:59 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 3.35 #1) id 1BYL8H-000IVe-0Y; Thu, 10 Jun 2004 09:41:57 +0100 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 1B09316B7A; Thu, 10 Jun 2004 09:41:57 +0100 (BST) Message-ID: <40C81ED3.70709@archonet.com> Date: Thu, 10 Jun 2004 09:41:55 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 0.6 (X11/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Martin_Sch=E4fer?= Cc: pgsql-sql@postgresql.org Subject: Re: Find out whether a view's column is indexed? References: <37936EEC582B394A9E1AA951991A551604C3BF@dev001_pdc.Dev.cadcorp.net> In-Reply-To: <37936EEC582B394A9E1AA951991A551604C3BF@dev001_pdc.Dev.cadcorp.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/80 X-Sequence-Number: 18025 Martin Schäfer wrote: > Is there any way to find out whether a column that's used in a view is indexed? > > The following query: > > SELECT ic.relname AS index_name [snip] > lets me find out whether a table column is indexed, but it doesn't work for views. Is there anything that can be done for views? At least for simple views of the kind 'CREATE VIEW v AS SELECT a,b,c FROM t'? If you're running 7.4 you can look in the information schema, in view_column_usage - that will tell you which table-columns a view uses. -- Richard Huxton Archonet Ltd