Re: why does this select hang postgres???

From: <pgsql-general(at)commandprompt(dot)com>
To: Jeremy Hansen <jeremy(at)xxedgexx(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: why does this select hang postgres???
Date: 2001-08-10 18:09:22
Message-ID: Pine.LNX.4.30.0108101106280.22311-100000@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 10 Aug 2001 pgsql-general(at)commandprompt(dot)com wrote:
>On Fri, 10 Aug 2001, Jeremy Hansen wrote:
>>select * from env_info,summary,plat_info;
>>Is my statement broken? Is this not legal? Postgres just sits there....
>Well, without a JOIN or a WHERE clause, this query is going to try create
>the raw cartesian product of the two tables.

Er, thought that was a dot. Make that three tables, even worse if these
are even large-ish tables.

I have no idea what your table structure is like, but assuming there is
some sort of relation between these tables, you'd really want to do
something like:

SELECT * FROM env_info INNER JOIN summary
ON (env_info.id=summary.id) INNER JOIN plat_info
ON (env_info.id=plat_info.id);

If there's no relationship between these tables, alternatively, I'm not
sure what you're trying to accomplish. ;)

Regards,
Jw.
--
jlx(at)commandprompt(dot)com by way of pgsql-general(at)commandprompt(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message pgsql-general 2001-08-10 18:13:14 Boolean Constants Implicit?
Previous Message Tom Lane 2001-08-10 18:08:29 Re: <Long> pg_xlog directory filled file system