Received: from orion.SAPserv.Hamburg.dsh.de (Tpolaris2.sapham.debis.de [53.2.131.8]) by hub.org (8.9.3/8.9.3) with SMTP id FAA44670 for ; Thu, 8 Jul 1999 05:09:01 -0400 (EDT) (envelope-from wieck@debis.com) Received: by orion.SAPserv.Hamburg.dsh.de for pgsql-sql@postgreSQL.org id m112A6U-0003ktC; Thu, 8 Jul 99 11:04 MET DST Message-Id: From: wieck@debis.com (Jan Wieck) Subject: Re: [SQL] Good Optimization To: kudo@partitur.se (Patrik Kudo) Date: Thu, 8 Jul 1999 11:04:26 +0200 (MET DST) Cc: maillist@candle.pha.pa.us, pgsql-sql@postgreSQL.org Reply-To: jwieck@debis.com (Jan Wieck) In-Reply-To: <37845CC3.A2391717@partitur.se> from "Patrik Kudo" at Jul 8, 99 10:09:39 am X-Mailer: ELM [version 2.4 PL25] Content-Type: text > > Bruce Momjian wrote: > >=20 > > Added to TODO: > >=20 > > * In WHERE x=3D3 AND x=3Dy, add y=3D3 > > I don't know if I'm way off, but wouldn't removing "x=3Dy" improve > performance further? Maybe in the simple case above. But it will probably change the result set if someone issues SELECT a.x, b.y FROM a, b WHERE a.x >= 10 AND a.x <= 19 AND a.x = b.x; which should then get rewritten into SELECT a.x, b.y FROM a, b WHERE a.x >= 10 AND a.x <= 19 AND a.x = b.x AND b.x >= 10 AND b.x <= 19; This time the "a.x = b.x" is important! IMHO we're improving optimization more and more on the cost of query parse/rewrite/optimize/plan time. Thus performance of statements that EXECUTE fast slows down more and more. Isn't it time to think about some (maybe shared) "parsetree->plan" cache that provides ready to use plans if only Const values have changed? Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #========================================= wieck@debis.com (Jan Wieck) #