From: Tom Lane <tgl@sss.pgh.pa.us>
To: Zoltan Boszormenyi <zboszor@dunaweb.hu>
Cc: pgsql-odbc@postgresql.org
Subject: Re: PsqlODBC slow on UNION queries
Date: Mon, 09 Jan 2006 00:18:42 -0500
Message-ID: <25908.1136783922@sss.pgh.pa.us> (raw)
In-Reply-To: <43C1F84A.90707@dunaweb.hu>
References: <43C1F84A.90707@dunaweb.hu>
Zoltan Boszormenyi <zboszor@dunaweb.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: tgl@sss.pgh.pa.us, zboszor@dunaweb.hu
Subject: Re: PsqlODBC slow on UNION queries
In-Reply-To: <25908.1136783922@sss.pgh.pa.us>
References: <43C1F84A.90707@dunaweb.hu> <25908.1136783922@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox