Performance difference: SELECT from VIEW or not?

From: Alexandre Leclerc <alexandre(dot)leclerc(at)gmail(dot)com>
To: PERFORM <pgsql-performance(at)postgresql(dot)org>
Subject: Performance difference: SELECT from VIEW or not?
Date: 2004-11-15 23:10:01
Message-ID: 1dc7f0e3041115151015e34130@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

I'm just currious about which is the best, if I have many query based
on the first one:

-- suppose this view (used many times):
CREATE VIEW prod.alljobs_view AS
SELECT *
FROM prod.jobs
LEFT JOIN prod.jobs_products ON jobs.job_id = jobs_products.job_id;

-- suppose this other query:
CREATE VIEW prod.orders_jobs_view AS
SELECT job_id, order_id, product_code
FROM prod.alljobs_view
LEFT JOIN design.products ON alljobs_view.product_id =
products.product_id;

-- would this be more effective on database side than:?
CREATE VIEW prod.orders_jobs_view AS
SELECT job_id, order_id, product_code
FROM prod.jobs
LEFT JOIN prod.jobs_products ON jobs.job_id = jobs_products.job_id
LEFT JOIN design.products ON jobs_products.product_id =
products.product_id;

Which is the best, or is there any difference? (I can't test it
myself, I have too few data).

Regards.

--
Alexandre Leclerc

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2004-11-15 23:30:41 Re: Performance difference: SELECT from VIEW or not?
Previous Message Allen Landsidel 2004-11-15 22:22:36 Re: Strange (?) Index behavior?