> > For me it seems to be slow due to the sorting. Is this right?
> > Is this normal at all? Is it possible to make it faster?
>
> If you know, that your result does not produce duplicates
> (which are filtered away with "union") you can use a
> "union all" which should be substantially faster,
Kovacs Zoltan writes:
> I experienced that UNIONs in 7.1.1 are rather slow:
>
> tir=# explain (select nev from cikk) union (select tevekenyseg from log);
Try UNION ALL. Plain UNION will eliminate duplicates, so it becomes
slower.
--
Peter Eisentraut [EMAIL PROTECTED] http://funkturm.homei
> I experienced that UNIONs in 7.1.1 are rather slow:
>
> tir=# explain (select nev from cikk) union (select
> tevekenyseg from log);
> NOTICE: QUERY PLAN:
>
> Unique (cost=667.63..687.18 rows=782 width=12)
> -> Sort (cost=667.63..667.63 rows=7817 width=12)
> -> Append (cost=0.
Kovacs,
A 'union all' will be much faster than 'union'. 'union all' returns all
results from both queries, whereas 'union' will return all distinct
records. The 'union' requires a sort and a merge to remove the
duplicate values. Below are explain output for a union query and a
union all q
I experienced that UNIONs in 7.1.1 are rather slow:
tir=# explain (select nev from cikk) union (select tevekenyseg from log);
NOTICE: QUERY PLAN:
Unique (cost=667.63..687.18 rows=782 width=12)
-> Sort (cost=667.63..667.63 rows=7817 width=12)
-> Append (cost=0.00..162.17 rows=7817