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 4F2BED1B2A6 for ; Thu, 10 Jun 2004 04:56:15 -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 83163-04 for ; Thu, 10 Jun 2004 07:56:12 +0000 (GMT) Received: from smarthost0.mail.uk.easynet.net (smarthost0.mail.uk.easynet.net [212.135.6.10]) by svr1.postgresql.org (Postfix) with ESMTP id 965F6D1B1B3 for ; Thu, 10 Jun 2004 04:56:08 -0300 (ADT) Received: from [195.40.158.200] (helo=dev001_pdc.Dev.cadcorp.net) by smarthost0.mail.uk.easynet.net with esmtp (Exim 4.10) id 1BYKPx-0000tI-00 for pgsql-sql@postgresql.org; Thu, 10 Jun 2004 08:56:09 +0100 Subject: Find out whether a view's column is indexed? MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Thu, 10 Jun 2004 08:56:05 +0100 Message-ID: <37936EEC582B394A9E1AA951991A551604C3BF@dev001_pdc.Dev.cadcorp.net> content-class: urn:content-classes:message X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Find out whether a view's column is indexed? Thread-Index: AcROwGIL0aAUQQiqSIarTo+AtwsZQg== From: =?iso-8859-1?Q?Martin_Sch=E4fer?= To: 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/79 X-Sequence-Number: 18024 Is there any way to find out whether a column that's used in a view is inde= xed? =20 The following query: SELECT ic.relname AS index_name FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a, pg_opclass oc, pg_namespace n WHERE i.indrelid =3D bc.oid AND i.indexrelid =3D ic.oid AND i.indkey[0] =3D a.attnum AND i.indclass[0] =3D oc.oid AND a.attrelid =3D bc.oid AND oc.opcname =3D 'gist_geometry_ops' AND n.oid =3D bc.relnamespace AND bc.relkind ~ '[rv]' AND ic.relkind =3D 'i' AND n.nspname =3D 'foo' AND bc.relname =3D 'bar' AND a.attname =3D 'foobar'; 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 v= iews of the kind 'CREATE VIEW v AS SELECT a,b,c FROM t'? Can anybody help? =20 Martin PS: as you can see from the query I'm using the PostGIS extension, and I'm = only interested in spatial indices on geometry columns.