pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: James Cooper <jim@luckydigital.com>
To: sql <pgsql-sql@postgresql.org>
Subject: a change of query
Date: Wed, 26 Feb 2003 11:03:35 +1300
Message-ID: <004a01c2dd19$be6fe400$c900a8c0@jax> (raw)

select distinct cp.person_id from cluster_person cp, cluster c where cp.cluster_id = c.cluster_id and c.c_id = 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 however 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 Diagniostics ROW_COUNT - 

thoughts?



James

view thread (4+ messages)  latest in thread

Message-ID: <004a01c2dd19$be6fe400$c900a8c0@jax>
Permalink:  ../004a01c2dd19$be6fe400$c900a8c0@jax/
Also on:    postgresql.org/message-id/004a01c2dd19$be6fe400$c900a8c0@jax

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jim@luckydigital.com
  Subject: Re: a change of query
  In-Reply-To: <004a01c2dd19$be6fe400$c900a8c0@jax>

* 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