Re: UNION and bad performance
| От | Robert Haas |
|---|---|
| Тема | Re: UNION and bad performance |
| Дата | |
| Msg-id | AANLkTinC0ZcS1N54T-jmpj3VPWVnW15apmWVCKucgnD0@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: UNION and bad performance (pasman pasmański <pasman.p@gmail.com>) |
| Ответы |
Re: UNION and bad performance
|
| Список | pgsql-performance |
2010/12/12 pasman pasmański <pasman.p@gmail.com>:
>> UNION will remove all duplicates, so that the result additionally requires to
>> be sorted.
>
>>Right, to avoid the SORT and UNIQUE - operation you can use UNION ALL
>
>
> by the way maybe apply hashing to calculate UNION be better ?
The planner already considers such plans.
rhaas=# explain select a from generate_series(1,100) a union select a
from generate_series(1,100) a;
QUERY PLAN
--------------------------------------------------------------------------------------
HashAggregate (cost=45.00..65.00 rows=2000 width=4)
-> Append (cost=0.00..40.00 rows=2000 width=4)
-> Function Scan on generate_series a (cost=0.00..10.00
rows=1000 width=4)
-> Function Scan on generate_series a (cost=0.00..10.00
rows=1000 width=4)
(4 rows)
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
В списке pgsql-performance по дате отправления: