pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Keith Gray <keith@heart.com.au>
To: Richard Huxton <dev@archonet.com>
Cc: PostgreSQL <pgsql-sql@postgresql.org>
Subject: Re: Index on View ?
Date: Fri, 06 Apr 2001 09:14:59 +1000
Message-ID: <3ACCFC73.1A2EEC1A@heart.com.au> (raw)
References: <3ACBF22F.33AA9C36@heart.com.au>
	<012a01c0bdac$d7864760$1001a8c0@archonet.com>

Richard Huxton wrote:
> 
> Indexes on underlying tables should be used though. Difficult to suggest
> what indices you might need without knowing the view/tables/queries
> involved.

As an example I may have an "Invoice" table with several thousand invoices.
I could design a query/view "Aged" to get all unpaid invoices 
greater than 15 days old.

I would often look for Invoices per Client and should have an index on 
Invoice(ClientID).

	e.g. CREATE INDEX Invoice_ClientID ON Invoice(ClientID);


Is there any advantage in having an index on ClientID for the Aged query?

	e.g. CREATE INDEX Aged_ClientID ON Aged(ClientID);

Would this index be continually maintained by the RDBMS or only on lookup?




Keith



view thread (5+ messages)  latest in thread

Message-ID: <3ACCFC73.1A2EEC1A@heart.com.au>
Permalink:  ../3ACCFC73.1A2EEC1A@heart.com.au/
Also on:    postgresql.org/message-id/3ACCFC73.1A2EEC1A@heart.com.au

 · 

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: keith@heart.com.au, dev@archonet.com
  Subject: Re: Index on View ?
  In-Reply-To: <3ACCFC73.1A2EEC1A@heart.com.au>
  References: <3ACBF22F.33AA9C36@heart.com.au> <012a01c0bdac$d7864760$1001a8c0@archonet.com> <3ACCFC73.1A2EEC1A@heart.com.au>

* 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