is grouping over many columns avoidable?

From: Holger Klawitter <holger(at)klawitter(dot)de>
To: "pgsql-general(at)postgreSQL(dot)org" <pgsql-general(at)postgreSQL(dot)org>
Subject: is grouping over many columns avoidable?
Date: 2001-02-06 15:42:08
Message-ID: 3A801B50.C52445EE@klawitter.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi there,

I would like to do a query in order to retrieve a complete row
of a table maching a number of requirements being stored
in another table. The best I could think of was:

select
x.id, x.1, x.2, ..., x.30
from
x, y
where
x.id = y.id and x.name like 'bla%' (y.attr=val1 or y.attr=val2)
group by
x.id, x.1, x.2, ..., x.30
having
count(*) = 2
order by
x.value desc

The grouping looks pretty stupid, is there any faster way to
write a query like that (using 'in' and a subselect to grab the
ids from x made the program 10 times slower...)

With kind regards / Mit freundlichem Gruß
Holger Klawitter
--
Holger Klawitter
holger(at)klawitter(dot)de http://www.klawitter.de

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Wood 2001-02-06 15:47:20 Re: Problems with Relationships in SQL7
Previous Message George Johnson 2001-02-06 15:30:48 RE: Solaris 8 compilation errors _OUTPUT