Re: Boolean product of rows in multiple tables

Поиск
Список
Период
Сортировка
От Artur Rataj
Тема Re: Boolean product of rows in multiple tables
Дата
Msg-id Pine.LNX.4.33.0212301933210.23226-100000@linux.iitis.gliwice.pl
обсуждение исходный текст
Ответ на Re: Boolean product of rows in multiple tables  (Jean-Luc Lachance <jllachan@nsd.ca>)
Список pgsql-general
On Mon, 30 Dec 2002, Jean-Luc Lachance wrote:

> I think you are looking for UNION.
>

If there would be one component more:

> SELECT id from table1 t1, table2 t2 where t1.string = 'string1' and
> t2.string='string2' and t1.id=t2.id
> UNION
> SELECT id from table1 t1, table1 t2 where t1.string = 'string1' and
> t2.string='string2' and t1.id=t2.id
> UNION
> SELECT id from table2 t1, table2 t2 where t1.string = 'string1' and
> t2.string='string2' and t1.id=t2.id

UNION
SELECT id from table2 t1, table1 t2 where t1.string = 'string1' and
t2.string='string2' and t1.id=t2.id

> ;
>

it would work in the discussed case. The problem is that there can be
several such tables and there can also be several strings, what could give a
relatively large number of such components, and in effect it could be slow.
A table being a sum of the several searched tables could be used with a
single fast `select', but because an arbitrary subset of the available
tables could possibly be searched, a relatively large number of tables being
sums of the tables in the arbitrary subsets would then be needed.

Best regards,
Artur Rataj


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

Предыдущее
От: Doug McNaught
Дата:
Сообщение: Re: lock table question
Следующее
От: Medi Montaseri
Дата:
Сообщение: Re: pg and transactions