Re: DESIGN OF A SELECT QUERY

From: Lew <noone(at)lwsc(dot)ehost-services(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: DESIGN OF A SELECT QUERY
Date: 2010-03-21 19:59:41
Message-ID: ho5trc$iqb$2@news.albasani.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

JORGE MALDONADO wrote:
> I have designed a SELECT query by hand and by using a query designer and
> I see a difference. Such a query includes 11 tables and I would like
> your comments.
>
> The designer result is somthing like:
> SELECT fld1, fld2,...,fldn FROM tbl1
> INNER JOIN .......
> INNER JOIN .......
>
> The query I wrote is as follows although I do not know if it works:
> SELECT fld1, fld2,...,fldn FROM
> tbl1
> INNER JOIN...ON....
> INNER JOIN...ON....,
>
> tlb2
> INNER JOIN...ON...
> INNER JOIN...ON...,
>
> tbl3
> INNER JOIN...ON...
> INNER JOIN...ON...
>
> If you watch closely, the query generated by the designer includes only
> one table in the FROM and all of the INNER JOIN's follow after it.
> My design includes several tables in the FROM each one with its own
> INNER JOIN's.
>
> Is this valid?
> Please advice.

It may be valid, but the semantics will differ between the two forms.

The "designer result" will create one massive INNER JOIN between however many
tables.

The second form will create a cross join between the different INNER JOIN parts.

--
Lew

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message A. Kretschmer 2010-03-22 08:07:31 Re: Speed question - new view using preview view components
Previous Message Van Ly 2010-03-21 02:12:15 Re: Speed question - new view using preview view components