$a = $db->prepare("SELECT COUNT(table.column) FROM TABLE");
$a->execute


----- Original Message -----
From: "Andrew Kuebler" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 30, 2002 12:13 PM
Subject: Number Of Records in a Table


> Everyone on this list has been very helpful so far. I greatly appreciate
> all the help!
>
> I use Perl/DBI with MySQL. Normally to count records, I pull a query
> like:
>
> $a = $db->prepare("SELECT * FROM table");
> $a->execute;
>
> Then:
>
> $numrows = $a->rows;
>
> to get a total count of records in the table. Is there an easier/faster
> way to do this if I'm looking only for the total record count for an
> entire table? On a large table, the operations above can be very time
> consuming & processor intensive. I know in the MySQL admin screen you
> can get the total # of items in a table as long as you have at least one
> column indexed & I would assume there is a way to extract that # from
> within Perl. Can anyone help?
>
> Thank you again!
>
> Andrew
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to