pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vadim Mikheev <vadim@krs.ru>
To: Jan Wieck <jwieck@debis.com>
Cc: s-fery@kkt.sote.hu
Cc: pgsql-sql@postgreSQL.org
Cc: hackers@postgreSQL.org
Subject: Re: [HACKERS] Re: [SQL] cursor and update + view
Date: Wed, 25 Nov 1998 10:26:42 +0700
Message-ID: <365B78F2.F5E791D5@krs.ru> (raw)
References: <m0ziKjE-000EBYC@orion.SAPserv.Hamburg.dsh.de>

Jan Wieck wrote:
> 
> > rule system will be able to put _any_ VIEW' query into
> > FROM clause...
> 
>     Possible - but IMHO the wrong thing to do. As it is now for a

"Will be able" doesn't mean "will DO" -:))
I just said that subqueries in FROM will resolve all
problems with aggregates in VIEWs.

>     If  we put any view into a subquery RTE, we force the planner
>     to materialize the  view  and  do  a  nestloop  over  t3  and
         ^^^^^^^^^^^
Do you mean creating some tmp table etc?
No - it's not required.

>     materialized  v1  where  possibly  using  t1  or  t2  as  the
>     outermost scanrelation would be better.

  SELECT t3.a, v1.b, v1.c 
  FROM t3, 
       (SELECT t1.a, t1.b, t2.c FROM t1, t2 WHERE t1.a = t2.a) v1
  WHERE t3.a = v1.a;

can be planned as

    Nestloop
	SubPlan
           ...what is costless for subquery...
	Seq/Index scan on t3

- no materialization...

On the other hand, as we talk about query optimization - why
rule system should do optimizer' work? Why not just put
_any_ VIEW' query into FROM and let optimizer decide
could query be rewritten as join or not? Ppl do strange
things sometimes -:) Sometimes they use subqueries in
WHERE while joins could be used and our optimizer don't 
try to catch this. I know that Sybase does.
And, imho, we should implement this ... sometime -:))

Vadim



view thread (11+ messages)  latest in thread

Message-ID: <365B78F2.F5E791D5@krs.ru>
Permalink:  ../365B78F2.F5E791D5@krs.ru/
Also on:    postgresql.org/message-id/365B78F2.F5E791D5@krs.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: vadim@krs.ru, jwieck@debis.com, s-fery@kkt.sote.hu, hackers@postgreSQL.org
  Subject: Re: [HACKERS] Re: [SQL] cursor and update + view
  In-Reply-To: <365B78F2.F5E791D5@krs.ru>
  References: <m0ziKjE-000EBYC@orion.SAPserv.Hamburg.dsh.de> <365B78F2.F5E791D5@krs.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox