X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 255699FA4A7 for ; Fri, 30 Jun 2006 09:35:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 71502-02 for ; Fri, 30 Jun 2006 09:35:52 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pjetlic.mobart.hr (pjetlic.mobart.hr [80.80.51.10]) by postgresql.org (Postfix) with ESMTP id CEDAF9FA163 for ; Fri, 30 Jun 2006 09:35:52 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by pjetlic.mobart.hr (Postfix) with ESMTP id E359817E2A for ; Fri, 30 Jun 2006 14:35:48 +0200 (CEST) Received: from pjetlic.mobart.hr ([127.0.0.1]) by localhost (pjetlic [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 07861-02 for ; Fri, 30 Jun 2006 14:35:48 +0200 (CEST) Received: from mike.mobart.hr (mike.mobart.hr [192.168.10.94]) (using SSLv3 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by pjetlic.mobart.hr (Postfix) with ESMTP id BBC0A17E0C for ; Fri, 30 Jun 2006 14:35:48 +0200 (CEST) Subject: Views and query planner From: Mario Splivalo Reply-To: mario.splivalo@mobart.hr To: pgsql-sql@postgresql.org Content-Type: text/plain Organization: Mob-Art Date: Fri, 30 Jun 2006 14:35:48 +0200 Message-Id: <1151670948.27032.5.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by OpenSource AV+AS Mail Server X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/331 X-Sequence-Number: 25567 Let's say I have a view like this: CREATE VIEW v_small AS SELECT c1, c2 FROM t1 JOIN t2 ON t1.c1 = t2.c2 and then I have another view CREATE VIEW v_big AS SELECT c1 FROM v_small WHERE c2 > 5 Now, when I do this: SELECT * FROM v_big WHERE c1 < 1500 Is postgres going to make one query plan, or each view has it own query plan? Mike -- Mario Splivalo Mob-Art mario.splivalo@mobart.hr "I can do it quick, I can do it cheap, I can do it well. Pick any two."