Received: from dsh.de (firewall-user@neptun.sns-felb.debis.de [53.122.101.2]) by hub.org (8.9.1/8.9.1) with ESMTP id MAA13288 for ; Wed, 28 Oct 1998 12:40:05 -0500 (EST) (envelope-from wieck@sapserv.debis.de) Received: by dsh.de; id SAA25730; Wed, 28 Oct 1998 18:42:13 +0100 (MET) Received: from dshmail.dsh.de(53.47.15.3) by neptun.dsh.de via smap (3.2) id xma025521; Wed, 28 Oct 98 18:41:46 +0100 Received: from mail1.hh1.dsh.de (mail1.hh1.dsh.de [53.47.9.5]) by dshmail.dsh.de (8.8.7/8.8.7) with ESMTP id SAA13502; Wed, 28 Oct 1998 18:39:13 +0100 (MET) Received: from mars.SAPserv.Hamburg.dsh.de (root@mail5.hh1.dsh.de [53.2.168.17]) by mail1.hh1.dsh.de (8.8.7/8.8.7) with SMTP id SAA31627; Wed, 28 Oct 1998 18:41:49 +0100 Received: from orion.SAPserv.Hamburg.dsh.de by mars.SAPserv.Hamburg.dsh.de with smtp for <> id m0zYXGg-000B5AC; Wed, 28 Oct 98 16:12 MET Received: by orion.SAPserv.Hamburg.dsh.de for djackson@cpsgroup.com id m0zYZpI-000EBPC; Wed, 28 Oct 98 18:56 MET Message-Id: From: jwieck@debis.com (Jan Wieck) Subject: Re: [SQL] Joining bug???? To: djackson@cpsgroup.com (Jackson, DeJuan) Date: Wed, 28 Oct 1998 18:56:08 +0100 (MET) Cc: jwieck@debis.com, caffeine@toodarkpark.org, selkovjr@mcs.anl.gov, pierre@desertmoon.com, pgsql-sql@postgreSQL.org Reply-To: jwieck@debis.com (Jan Wieck) In-Reply-To: from "Jackson, DeJuan" at Oct 28, 98 11:11:51 am X-Mailer: ELM [version 2.4 PL25] Content-Type: text > > > > try making a view. from what others have said, views save the query > > plan > > > and have usually, at least for me, been _alot_ faster than normal > > queries. > > > > Views don't save query plans. They are parsetree templates in > > query rewrite rules. > > > So, could you explain what counts for the speed increase. Is the parse > stage really that costly? BTW: You might want to take a look at the new documentation of the rule system to understand how views work in detail. It could only be the parse stage. After the rule system is through with the query, the parsetree given to the optimizer is exactly the same as if you typed in the query that accesses the real tables. Having a view CREATE VIEW v1 AS SELECT t1.a, t2.b FROM t1, t2 WHERE t1.a = t2.a; and doing a SELECT * FROM v1 WHERE a = 'something'; is 100% the same as SELECT t1.a, t2.b FROM t1, t2 WHERE t1.a = 'something' AND t1.a = t2.a; The optimizer will get exactly the same parsetree and will generate the same plan then. So the timing difference cannot be in the optimizer or executor. But it's interesting. I'll do some tests on it and try to find out whether parsing of complicated WHERE clauses is that costly that it can be the reason. Seems the rule system is quicker than the parser :-) Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #======================================== jwieck@debis.com (Jan Wieck) #