Re: [HACKERS] Re: [SQL] cursor and update + view

From: Vadim Mikheev <vadim(at)krs(dot)ru>
To: Jan Wieck <jwieck(at)debis(dot)com>
Cc: s-fery(at)kkt(dot)sote(dot)hu, pgsql-sql(at)postgreSQL(dot)org, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Re: [SQL] cursor and update + view
Date: 1998-11-25 03:26:42
Message-ID: 365B78F2.F5E791D5@krs.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Meyer 1998-11-25 03:58:29 Constraint check that crashes backend...
Previous Message Thomas G. Lockhart 1998-11-25 02:58:25 Re: [HACKERS] 6.4.1 schedule (was segfault with -z option)

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 1998-11-25 10:37:04 Re: [HACKERS] Re: [SQL] cursor and update + view
Previous Message G. Anthony Reina 1998-11-25 01:49:48 Re: [SQL] Question about schema