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 3AAAB32A08C for ; Tue, 28 Sep 2004 13:58:31 +0100 (BST) 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 14388-09 for ; Tue, 28 Sep 2004 12:58:20 +0000 (GMT) Received: from bugs.unl.edu.ar (bugs.unl.edu.ar [168.96.132.208]) by svr1.postgresql.org (Postfix) with ESMTP id 30DC932A023 for ; Tue, 28 Sep 2004 13:58:22 +0100 (BST) Received: from localhost (localhost [127.0.0.1]) by bugs.unl.edu.ar (Postfix) with ESMTP id 22D8312356 for ; Tue, 28 Sep 2004 09:55:33 -0300 (ART) Received: from bugs.unl.edu.ar ([127.0.0.1]) by localhost (bugs [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25176-06 for ; Tue, 28 Sep 2004 09:55:32 -0300 (ART) Received: from localhost (localhost [127.0.0.1]) by bugs.unl.edu.ar (Postfix) with ESMTP id EAD6A11E15 for ; Tue, 28 Sep 2004 09:55:31 -0300 (ART) From: Martin Marques To: pgsql-sql@postgresql.org Subject: Best way to know if there is a row Date: Tue, 28 Sep 2004 09:55:23 -0300 User-Agent: KMail/1.6.2 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200409280955.23773.martin@bugs.unl.edu.ar> X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at bugs.unl.edu.ar X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/240 X-Sequence-Number: 19086 I have a bunch of queries in a system I'm finishing, and I bumped with a=20 question on performace. Which is the best way to solve this: I need to know if there is at least one row in the relation that comes from= a=20 determinated query. Which is the best way to do this: (a) Build the query with "SELECT * ..." and after executing the query see i= f=20 numRows()>0 (b) Build the query with "SELECT count(*) ...", fetch the row and see if=20 count>0 I'm working with (a) because I see it better in performace, but I wanted to= be=20 sure the numRows() will actually give me the exact amount of rows (had some= =20 problems in the past with Informix). The aplication is written in PHP. --=20 09:45:02 up 16 days, 3 min, 4 users, load average: 3.32, 2.69, 1.77 ----------------------------------------------------------------- Mart=EDn Marqu=E9s | select 'mmarques' || '@' || 'unl.edu.ar' Centro de Telematica | DBA, Programador, Administrador Universidad Nacional del Litoral -----------------------------------------------------------------