X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AF78D5288E for ; Fri, 22 Jul 2005 00:12:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35578-03 for ; Fri, 22 Jul 2005 03:11:58 +0000 (GMT) Received: from griffin.idwebhost.com (unknown [202.67.9.242]) by svr1.postgresql.org (Postfix) with ESMTP id CBBCD5284E for ; Fri, 22 Jul 2005 00:11:54 -0300 (ADT) Received: from [222.124.53.163] (helo=nebulla) by griffin.idwebhost.com with esmtpa (Exim 4.44) id 1Dvnwn-0008UY-7H for pgsql-sql@postgresql.org; Fri, 22 Jul 2005 10:11:39 +0700 Reply-To: From: "Ricky Sutanto" To: Subject: Counting Row Date: Fri, 22 Jul 2005 10:13:12 +0700 Organization: PT. Connexia Makmur Jaya MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0009_01C58EA5.F8B078B0" X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Thread-Index: AcWN36RwvfiTKp6GSyG9O8d5HarUCQAi5rOQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - griffin.idwebhost.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - connexiasolutions.com X-Source: X-Source-Args: X-Source-Dir: Message-Id: <20050722031154.CBBCD5284E@svr1.postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.705 tagged_above=0 required=5 tests=HTML_MESSAGE, MSGID_FROM_MTA_ID X-Spam-Level: * X-Archive-Number: 200507/210 X-Sequence-Number: 22188 This is a multi-part message in MIME format. ------=_NextPart_000_0009_01C58EA5.F8B078B0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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, ------=_NextPart_000_0009_01C58EA5.F8B078B0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

 

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=3D"select * from [MYTABLE] where = [CONDITION] order by [FIELDORDER];

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

$ctr=3D1;

$pos=3D0;

  

   while (!$rs->EOF) {

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

        = $pos=3D$ctr;

        = break;

      } else = {

      = $ctr++;

      = $rs->MoveNext();  }

    }

 

   print $pos

 

 

is there any method to do that with = simple??

 

Thanks,

 

------=_NextPart_000_0009_01C58EA5.F8B078B0--