pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martin Schäfer <Martin.Schaefer@cadcorp.com>
To: pgsql-sql@postgresql.org
Subject: How to find out programmatically whether a query on a view will use an index?
Date: Mon, 24 Jan 2005 16:34:09 -0000
Message-ID: <37936EEC582B394A9E1AA951991A551609D274@dev001_pdc.Dev.cadcorp.net> (raw)

Hi,

I'm using the PostGIS spatial extension. Some of my spatial queries (like 
live zooming and panning) should only be performed when the column 
containing the spatial data is spatially indexed, otherwise the first query 
takes almost forever and users will just kill the application out of 
frustration.

I can easily find out whether a spatial column in a table is spatially 
indexed, using pg_class, pg_index, and pg_opclass. But this doesn't work for 
views. I can't find out whether a column in a view, is just an 'exact copy' 
of a column in a table (indicating that there's a chance that an index on 
the table column could be used for a query on the view column), or whether 
the column in the view defines some kind of operation, rendering any 
possible index on the table column useless.



view thread (5+ messages)  latest in thread

Message-ID: <37936EEC582B394A9E1AA951991A551609D274@dev001_pdc.Dev.cadcorp.net>
Permalink:  ../37936EEC582B394A9E1AA951991A551609D274@dev001_pdc.Dev.cadcorp.net/
Also on:    postgresql.org/message-id/37936EEC582B394A9E1AA951991A551609D274@dev001_pdc.Dev.cadcorp.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: Martin.Schaefer@cadcorp.com
  Subject: Re: How to find out programmatically whether a query on a view will use an index?
  In-Reply-To: <37936EEC582B394A9E1AA951991A551609D274@dev001_pdc.Dev.cadcorp.net>
  References: <37936EEC582B394A9E1AA951991A551609D274@dev001_pdc.Dev.cadcorp.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox