Re: Index on View ? - Mailing list pgsql-sql

From Keith Gray
Subject Re: Index on View ?
Date
Msg-id 3ACCFC73.1A2EEC1A@heart.com.au
Whole thread Raw
In response to Index on View ?  (Keith Gray <keith@heart.com.au>)
List 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


pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: please help
Next
From: "J.Fernando Moyano"
Date:
Subject: Re: very very slow .....