Re: Fastest way to get table records' number

From: Date: Wed, 19 Mar 2008 13:42:57 +0000
Subject: Re: Fastest way to get table records' number
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-271780@lists.php.net to get a copy of this message
On Tue, Mar 18, 2008 at 11:47 PM, Nathan Nobbe <quickshiftin@gmail.com> wrote: > On Tue, Mar 18, 2008 at 11:43 PM, Shelley <myphplist@gmail.com> 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 That works; I'm just wondering why you went with a count on an 'ID' column rather than COUNT(*). Andrew

« previous php.general (#271780) next »