Re: Fastest way to get table records' number

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nathan Nobbe wrote:
On Tue, Mar 18, 2008 at 11:43 PM, Shelley <myphplist@xxxxxxxxx> wrote:

Hi all,

What do you think is the FASTEST sql to get the total number of a table
with millions of records?


when you say 'total number' do you mean the total number of records?  in
that case assuming the table has a field 'id' then i think
select count(id) from some_table;

-nathan


If you are talking about millions of rows then the fastest way is to put a trigger on create and delete on the table in question that updates a single column in another table that is a counter.

HTH,

Mikey

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux