X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D69D0475B33 for ; Tue, 25 Feb 2003 17:30:56 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 00174-03 for ; Tue, 25 Feb 2003 17:30:28 -0500 (EST) Received: from luckydigital.com (www.luckydigital.com [203.109.157.4]) by postgresql.org (Postfix) with ESMTP id 1920B475B8C for ; Tue, 25 Feb 2003 17:03:23 -0500 (EST) Received: from jax (203-109-198-1.akl.ihugultra.co.nz [203.109.198.1]) by luckydigital.com (8.11.6/8.10.0) with SMTP id h1PM3NT30017 for ; Wed, 26 Feb 2003 11:03:23 +1300 Message-ID: <004a01c2dd19$be6fe400$c900a8c0@jax> From: "James Cooper" To: "sql" Subject: a change of query Date: Wed, 26 Feb 2003 11:03:35 +1300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0047_01C2DD86.B5323D80" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/564 X-Sequence-Number: 11962 This is a multi-part message in MIME format. ------=_NextPart_000_0047_01C2DD86.B5323D80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable select distinct cp.person_id from cluster_person cp, cluster c where cp.clu= ster_id =3D c.cluster_id and c.c_id =3D 1 can this query be changed to give just the row count?( of the distinct rows= ) yes: i am aware of count() but this wont count the distinct rows - I can ho= wever achive this with an nested person_id in(select... etc but that slows = things down big time!!!! the above quey gives me my resultset asap - is there a way to get just the = number of rows with the same speed My thoughts are that I could just make a plpgsql function with a GET Diagn= iostics ROW_COUNT -=20 thoughts? James ------=_NextPart_000_0047_01C2DD86.B5323D80 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

select distinct cp.person_id from cluster_person cp, cluster c where cp.cluster_id =3D c.cluster_id = and c.c_id =3D 1

can this query be changed to give just the row count?( of= the=20 distinct rows )

yes: i am aware of count() but this wont count the distin= ct rows=20 - I can however achive this with an nested person_id in(select... etc=20 but that slows things down big time!!!!

the above quey gives me my resultset asap - is there a wa= y to=20 get just the number of rows with the same speed

My thoughts are that I could just make a plpgsql  fu= nction=20 with a GET Diagniostics ROW_COUNT -

thoughts?

 

James

 

------=_NextPart_000_0047_01C2DD86.B5323D80--