Re: Indexed views?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tiago Wright <tiagowright(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Indexed views?
Date: 2004-09-07 02:40:10
Message-ID: 24334.1094524810@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tiago Wright <tiagowright(at)gmail(dot)com> writes:
> For example, consider the view
> CREATE VIEW vw_lot AS
> SELECTproductid,lotid,parentlotid,lottype,lotname,productname
> FROMlot
> NATURALJOINproduct;

> where productname is in the product table, and lotname in the lot
> table. I would be interested in creating an index such as

> CREATE INDEX ix_vw_lot ON vw_lot (lotname, productname);

What purpose would this serve that indexes on the separate tables
wouldn't serve?

> The index would be enough to cover 90% of the queries against
> lot the lot and inventory tables.

This sounds to me like you are suffering from a common misconception.
Postgres cannot answer queries from the contents of indexes alone.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Schuchardt 2004-09-07 11:08:30 beta2 and blob's
Previous Message Tiago Wright 2004-09-07 02:13:12 Re: Indexed views?