slow UNIONing - Mailing list pgsql-hackers

From Kovacs Zoltan
Subject slow UNIONing
Date
Msg-id Pine.LNX.4.21.0109181548210.3295-100000@pc10.radnoti-szeged.sulinet.hu
Whole thread Raw
Responses Re: slow UNIONing  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
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.17rows=7817 width=12)             ->  Subquery Scan *SELECT* 1  (cost=0.00..28.16 rows=1316 width=12)
               ->  Seq Scan on cikk  (cost=0.00..28.16 rows=1316 width=12)             ->  Subquery Scan *SELECT* 2
(cost=0.00..134.01rows=6501 width=12)                   ->  Seq Scan on log  (cost=0.00..134.01 rows=6501 width=12)
 

Of course a simple SELECT is fast:

tir=# explain select nev from cikk;
NOTICE:  QUERY PLAN:

Seq Scan on cikk  (cost=0.00..28.16 rows=1316 width=12)


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?

TIA, Zoltan

--                         Kov\'acs, Zolt\'an                        kovacsz@pc10.radnoti-szeged.sulinet.hu
          http://www.math.u-szeged.hu/~kovzol                        ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz
 



pgsql-hackers by date:

Previous
From: Gunnar Rønning
Date:
Subject: Re: Major change to CVS effective immediately ...
Next
From: "news.grapid1.mi.home.com"
Date:
Subject: CVS access problem