Received: from mail.fiber.net (mail.fiber.net [216.83.130.4]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1JLrex05216 for ; Mon, 19 Feb 2001 16:53:40 -0500 (EST) (envelope-from phpPgAdmin@acucore.com) Received: from danwilson (bbudnick.employees.fiber.net [216.83.131.7]) by mail.fiber.net (8.10.1/8.10.1) with SMTP id f1JLrZf29155; Mon, 19 Feb 2001 14:53:35 -0700 (MST) Message-ID: <02c001c09ac6$6790d140$078353d8@danwilson> From: "Dan Wilson" To: , "pgsql-php" References: <3A9192B7.EF0D1A2B@nextearth.com> Subject: Re: Rows in tables... Date: Mon, 19 Feb 2001 14:50:47 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Archive-Number: 200102/26 X-Sequence-Number: 165 You may be looking for a query like this: SELECT * FROM [table] ORDER BY random() LIMIT 1 This will automtically select a random row and only return 1 tuple. This will cut down on your query time and the memory usage. I don't know if that was what you are trying to do. -Dan > What is the easiest way to get the total number of > rows in a table? I want to do a random pick from a > table and need to know how many rows are in the > table. > > Do I do a "SELECT * FROM table" and use the info > from this, or will a select return all the data? > This is where I'm hazy. Or does fetch_row actually > return the data? > > Any help is appreciated, > Herbie Pabst >