Counting Row

From: "Ricky Sutanto" <ricky(at)connexiasolutions(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Counting Row
Date: 2005-07-22 03:13:12
Message-ID: 20050722031154.CBBCD5284E@svr1.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi postgre people. Can anybody help to fix performance of my query?

Let say, I have n number of queue ticket. (Which I use SELECT).

Is there faster method to know where is my ticket number in queue?

I use (while in PHP script ) and count one by one until my ticket number
match with row field .

$sql="select * from [MYTABLE] where [CONDITION] order by [FIELDORDER];

$rs=&$ctclink->Execute($sql);

$ctr=1;

$pos=0;

while (!$rs->EOF) {

if ($rs->fields[0]==$recid) {

$pos=$ctr;

break;

} else {

$ctr++;

$rs->MoveNext(); }

}

print $pos

is there any method to do that with simple??

Thanks,

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Dongsoo Yoon 2005-07-22 06:30:22 Is there a type like a growable array, similar Vector at Java language in postgreSQL?
Previous Message Jamie Lawrence 2005-07-21 18:32:24 Different encodings in different DBs in same cluster