Re: why does this select hang postgres???

Поиск
Список
Период
Сортировка
От Mike Mascari
Тема Re: why does this select hang postgres???
Дата
Msg-id 3B7424D5.37012551@mascari.com
обсуждение исходный текст
Ответ на why does this select hang postgres???  (Jeremy Hansen <jeremy@xxedgexx.com>)
Ответы Re: why does this select hang postgres???  (Jeremy Hansen <jeremy@xxedgexx.com>)
Список pgsql-general
Jeremy Hansen wrote:
>
> select * from env_info,summary,plat_info;
>
> Is my statement broken?  Is this not legal?  Postgres just sits there....

Its quite possibly broken. It's legal to PostgreSQL; other databases
won't like the missing FROM clause. But PostgreSQL will generate the
Cartesian product of all three tables. If table 1 has 100 rows,
table 2 has 100 rows, and table 3 has 100 rows, PostgreSQL will have
to construct and return 100 * 100 * 100 rows = 1,000,000 rows.
>
> My goal is to select everything from multiple tables with one sql
> statement.

Are you sure you want each row of each table combined with each row
of each of the other tables? If these tables are related in any way
you have to provide a WHERE clause that specifies the relationship.

>
> Thank You!
> -jeremy

Mike Mascari
mascarm@mascari.com

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: why does this select hang postgres???
Следующее
От: Fernando Schapachnik
Дата:
Сообщение: Re: why does this select hang postgres???