Re: Index on View ?

From: Keith Gray <keith(at)heart(dot)com(dot)au>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: PostgreSQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Index on View ?
Date: 2001-04-05 23:14:59
Message-ID: 3ACCFC73.1A2EEC1A@heart.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ian Harding 2001-04-05 23:19:02 Re: Index on View ?
Previous Message Peter Eisentraut 2001-04-05 19:40:17 Re: please help