Re: Join efficiency

Поиск
Список
Период
Сортировка
От
Тема Re: Join efficiency
Дата
Msg-id 004d01c4901c$ba80be20$2766f30a@development.greatgulfhomes.com
обсуждение исходный текст
Ответ на Join efficiency  ("Russ Brown" <postgres@dot4dot.plus.com>)
Ответы ...
Список pgsql-general
NOTE: The first way cannot support OUTER joins, the second way can.  Hence sometimes one has to use
the second way for at least some of the joins.

PREVIOUSLY: The second way can allow one to tell the planner a "better way" to join the tables.
Likewise it can also enable the programmer to force the planner into a worse way.  Oops!
NOW: I believe that the latest version of postgres (7.4.x) the planner will override the 2nd methods
requested join method if it knows of a better way and can do the better way.  (Outer joins need to
be done last, by the nature of them, and so cannot be changed much, there may be other cases where
the planner cannot change the requested plan).

I am not an expert, but this is what I recall from following the list.

Terry Fielder
Manager Software Development and Deployment
Great Gulf Homes / Ashton Woods Homes
terry@greatgulfhomes.com
Fax: (416) 441-9085


> -----Original Message-----
> From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org]On Behalf Of Russ Brown
> Sent: Wednesday, September 01, 2004 7:55 AM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] Join efficiency
>
>
> Hello all,
>
> Recently a post on this list made me think a bit about the
> way in which I
> write my queries.
>
> I have always written queries with ordinary joins in this manner:
>
> SELECT * FROM a, b WHERE a.x=b.x;
>
> However I recently saw an laternative syntax:
>
> SELECT * FROM a JOIN b ON a.x=b.x;
>
> Is there any difference between these queries in terms of the
> speed of
> planning or the quality of the plan untimately used? I'd
> imagine that the
> second form provides more information that the planner may be
> able to use
> to make a better plan (or make a good plan more easily), but
> I've never
> had any problems with the first form.
>
> It also seems to me that the second form is more
> self-documenting, which
> is something I'm always in favour of.
>
> I'd appreciate anyone's thought/insight.
>
> Thanks.
>
> --
>
> Russell Brown
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index
> scan if your
>       joining column's datatypes do not match
>


В списке pgsql-general по дате отправления:

Предыдущее
От: "Russ Brown"
Дата:
Сообщение: Join efficiency
Следующее
От: Jerry LeVan
Дата:
Сообщение: Re: Types and SRF's