Performance difference: SELECT from VIEW or not?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux