Indexing Views

Started by sid@questions.comalmost 24 years ago3 messagesgeneral
Jump to latest
#1sid@questions.com
sbhatt@installs.com

hi,

I am storing intermediate results in a view and then using this view for
further processing, is it possible to index views in Postgres, if so how?
Any help will be much appreciated.

Sid

#2Jeff Davis
pgsql@j-davis.com
In reply to: sid@questions.com (#1)
Re: Indexing Views

I am storing intermediate results in a view and then using this view for
further processing, is it possible to index views in Postgres, if so how?
Any help will be much appreciated.

I don't think it's possible to store anything at all in a view. A view is just
a query-rewriting rule that can report data from existing tables, as if the
view was a table itself (but a view isn't a table).

Put proper indexes on the tables that are involved in the view and it should
work fine. If you're getting poor performance, report the output of EXPLAIN
for your query and maybe someone can help you optimize the query (or maybe
even make the planner better).

Regards,
Jeff

#3frbn
frbn@efbs-seafrigo.fr
In reply to: sid@questions.com (#1)
Re: Indexing Views

sid@questions.com wrote:

hi,

I am storing intermediate results in a view and then using this view for
further processing, is it possible to index views in Postgres, if so how?
Any help will be much appreciated.

you can use a temporary table which can be indexed.