pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexandre Leclerc <alexandre.leclerc@gmail.com>
To: PERFORM <pgsql-performance@postgresql.org>
Subject: Performance difference: SELECT from VIEW or not?
Date: Mon, 15 Nov 2004 18:10:01 -0500
Message-ID: <1dc7f0e3041115151015e34130@mail.gmail.com> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <1dc7f0e3041115151015e34130@mail.gmail.com>
Permalink:  ../1dc7f0e3041115151015e34130@mail.gmail.com/
Also on:    postgresql.org/message-id/1dc7f0e3041115151015e34130@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: alexandre.leclerc@gmail.com
  Subject: Re: Performance difference: SELECT from VIEW or not?
  In-Reply-To: <1dc7f0e3041115151015e34130@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox