Re: PsqlODBC slow on UNION queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zoltan Boszormenyi <zboszor(at)dunaweb(dot)hu>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: PsqlODBC slow on UNION queries
Date: 2006-01-09 05:18:42
Message-ID: 25908.1136783922@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Zoltan Boszormenyi <zboszor(at)dunaweb(dot)hu> writes:
> We have some large views, consisting of 6+ UNION members.
> Recently, I rewrote them to use UNION ALL, since the members
> give distinct rows across the whole view.

> The performance difference between the two is enormous, e.g. using UNION,
> the rows starts flowing only after 30-32 seconds but when using UNION ALL,
> it starts instantly.

Well, UNION requires fetching all the source rows and then doing a
duplicate-elimination step (sort+uniq basically). Why does the
performance change surprise you?

regards, tom lane

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Zoltan Boszormenyi 2006-01-09 05:44:42 PsqlODBC slow on UNION queries
Previous Message Campbell, Greg 2006-01-08 22:16:50 Re: Parameters.Refresh error.