Re: Union Query Improvement - Mailing list pgsql-general

From Ron Johnson
Subject Re: Union Query Improvement
Date
Msg-id 45D2BA53.2010100@cox.net
Whole thread Raw
In response to Union Query Improvement  (Ray Bannon <bannonr@comcast.net>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/13/07 07:46, Ray Bannon wrote:
> I have a query which is running a bit slowly, and I'm wondering if anyone
> has a design improvement. Basically it's a series of unions as follows:
>
> Select ID, plan_name from table/view
> Where plan_name = 'A'
> And rownum = 1
> UNION
> Select ID, plan_name from table/view
> Where plan_name = 'B'
> And rownum = 1
> UNION
> Select ID, plan_name from table/view
> Where plan_name = 'C'
> And rownum = 1
> UNION
>
> Ad infinitum for about 100 iterations.
>
> Any way to write this more efficiently?

Just out of curiosity: why does your(?) design have 100 tables/views
with the same (or almost identical) structure?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF0rpTS9HxQb37XmcRAtH5AJ4zz5NPM5rBsNWLrKC+/Md6GhxCNgCfZBHf
AeMbTRNKp4guK81pGwfU5wc=
=t9y+
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: Chris
Date:
Subject: Re: Slony Replication problem
Next
From: "Peter Eisentraut"
Date:
Subject: [ANNOUNCE] Advisory on possibly insecure security definer functions