Thread: Speed question - new view using preview view components
I wondered if when creating a new view from multiple tables, and then also joining to some fields of an existing view, if one pays much of a speed penalty when the data is retrieved, as opposed to just completely using all tables. Regards richard
--As of March 21, 2010 12:23:19 PM +1100, richard terry is alleged to have said: > I wondered if when creating a new view from multiple tables, and then > also joining to some fields of an existing view, if one pays much of a > speed penalty when the data is retrieved, as opposed to just completely > using all tables. --As for the rest, it is mine. First off, to help you answer your question (and others like it in the future) yourself: <http://www.postgresql.org/docs/8.4/interactive/sql-explain.html> Which I believe will tell you that there is no difference as far as Postgres is concerned. It will see the two selects (assuming they actually have the same structure) exactly the same: The view only makes it easier to write the first. (At least in this use.) Daniel T. Staal --------------------------------------------------------------- This email copyright the author. Unless otherwise noted, you are expressly allowed to retransmit, quote, or otherwise use the contents for non-commercial purposes. This copyright will expire 5 years after the author's death, or in 30 years, whichever is longer, unless such a period is in excess of local copyright law. ---------------------------------------------------------------
On 21/03/2010, at 12:23 PM, richard terry wrote: > I wondered if when creating a new view from multiple tables, and then also > joining to some fields of an existing view, if one pays much of a speed > penalty when the data is retrieved, as opposed to just completely using all > tables. It is possible to measure the time of performance. In one way I know, you could put the sql select call in a script for each of the two situations and on a unix-like platform call for timings with time sh situation0.sh time sh situation1.sh Best wishes. Van Ly van_ly@ovi.com -------------------------------------------------------------- Ovi Store: New apps daily http://store.ovi.com/?cid=ovistore-fw-bac-na-acq-na-ovimail-g0-na-3
In response to richard terry : > I wondered if when creating a new view from multiple tables, and then also > joining to some fields of an existing view, if one pays much of a speed > penalty when the data is retrieved, as opposed to just completely using all > tables. Depends. The upcoming release 9.0 contains a new feature called 'join removal'. http://akretschmer.blogspot.com/2010/02/join-removal-short-performance-test.html Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99