Re: Append table

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: Append table
Дата
Msg-id 87d50e5n5n.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на Re: Append table  (Arjen van der Meijden <acmmailing@tweakers.net>)
Список pgsql-performance
"Arjen van der Meijden" <acmmailing@tweakers.net> writes:

> There are two solutions:
...
> Or you can visually combine them without actually putting the records in a
> single table. That can be with a normal select-union statement or with a view,
> something like this:
> SELECT EmpId, EmpName FROM tabelA UNION EmpID, EmpName FROM tabelB;

If you're sure the two sets are distinct or you want to get any duplicates and
not eliminate them then if you went with this option you would want to use
"UNION ALL" not just a plain union.

In SQL UNION has to remove duplicates which often involves gathering all the
records and performing a big sort and lots of extra work. UNION ALL is much
faster and can start returning records right away.

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com


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

Предыдущее
От: Arjen van der Meijden
Дата:
Сообщение: Re: Append table
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Postgres Benchmark Results