On Mar 19, 2008, at 11:55 PM, Shelley wrote:
Nathan Nobbe wrote:
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard
[EMAIL PROTECTED] wrote:
That works; I'm just wondering why you went with a count on an
'ID' column
rather than COUNT(*).
ouch, it looks like im horribly wrong :O
mysql
On Tue, Mar 18, 2008 at 11:43 PM, Shelley [EMAIL PROTECTED] wrote:
Hi all,
What do you think is the FASTEST sql to get the total number of a table
with millions of records?
That question would be better on the PHP-DB list, so for archive's
sake, I'm CC'ing that list.
$sql = SELECT
On Tue, Mar 18, 2008 at 11:47 PM, Nathan Nobbe [EMAIL PROTECTED]
wrote:
On Tue, Mar 18, 2008 at 11:43 PM, Shelley [EMAIL PROTECTED] 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
Shelley wrote:
What do you think is the FASTEST sql to get the total number of a table
with millions of records?
Generally speaking 'select count(1) from table' is the quickest way, but
it really depends on the database and storage engine you're using. Your
best bet is to look at the
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard [EMAIL PROTECTED] wrote:
That works; I'm just wondering why you went with a count on an 'ID' column
rather than COUNT(*).
ouch, it looks like im horribly wrong :O
mysql select count(*) from table;
+--+
| count(*) |
+--+
|
Nathan Nobbe wrote:
On Tue, Mar 18, 2008 at 11:43 PM, Shelley [EMAIL PROTECTED] 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
At 10:35 AM -0400 3/19/08, Nathan Nobbe wrote:
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard [EMAIL PROTECTED] wrote:
That works; I'm just wondering why you went with a count on an 'ID' column
rather than COUNT(*).
ouch, it looks like im horribly wrong :O
mysql select count(*) from
On Wed, Mar 19, 2008 at 10:35 AM, Nathan Nobbe [EMAIL PROTECTED]
wrote:
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard [EMAIL PROTECTED]
wrote:
That works; I'm just wondering why you went with a count on an 'ID'
column
rather than COUNT(*).
ouch, it looks like im horribly wrong :O
On 19 Mar 2008, at 14:53, tedd wrote:
At 10:35 AM -0400 3/19/08, Nathan Nobbe wrote:
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard
[EMAIL PROTECTED] wrote:
That works; I'm just wondering why you went with a count on an
'ID' column
rather than COUNT(*).
ouch, it looks like im horribly
On Wed, Mar 19, 2008 at 10:53 AM, tedd [EMAIL PROTECTED] wrote:
At 10:35 AM -0400 3/19/08, Nathan Nobbe wrote:
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard [EMAIL PROTECTED] wrote:
That works; I'm just wondering why you went with a count on an 'ID' column
rather than COUNT(*).
On Wed, Mar 19, 2008 at 10:57 PM, Andrew Ballard [EMAIL PROTECTED] wrote:
On Wed, Mar 19, 2008 at 10:53 AM, tedd [EMAIL PROTECTED] wrote:
At 10:35 AM -0400 3/19/08, Nathan Nobbe wrote:
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard [EMAIL PROTECTED]
wrote:
That works; I'm
jeffry s wrote:
what about SELECT MAX(id) FROM table :)
Won't give you the number of records, just the highest ID.
-Stut
--
http://stut.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
At 10:35 AM -0400 3/19/08, Nathan Nobbe wrote:
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard [EMAIL PROTECTED]
wrote:
That works; I'm just wondering why you went with a count
on an 'ID'
column
rather than COUNT(*).
ouch, it looks like im horribly wrong :O
: [PHP] Fastest way to get table records' number
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard [EMAIL PROTECTED] wrote:
That works; I'm just wondering why you went with a count on an 'ID' column
rather than COUNT(*).
ouch, it looks like im horribly wrong :O
mysql select count(*) from
On Wed, Mar 19, 2008 at 1:04 PM, TG [EMAIL PROTECTED] wrote:
It seems that count(*) pulls all the data from the row then performs a count
increment whereas count(did) only pulls the 'did' column.
Again, I don't believe COUNT(*) pulls any data. If there is a row, it
simply counts it. The row
On Wed, Mar 19, 2008 at 1:19 PM, Andrew Ballard [EMAIL PROTECTED] wrote:
On Wed, Mar 19, 2008 at 1:04 PM, TG [EMAIL PROTECTED] wrote:
It seems that count(*) pulls all the data from the row then performs a
count
increment whereas count(did) only pulls the 'did' column.
Again, I
Hi,
did you try mysql_num_rows ?
--- Andrew Ballard [EMAIL PROTECTED] wrote:
On Wed, Mar 19, 2008 at 1:04 PM, TG
[EMAIL PROTECTED] wrote:
It seems that count(*) pulls all the data from
the row then performs a count
increment whereas count(did) only pulls the 'did'
column.
Again,
Doesn't the 1 in Select count(1) from table refer to the first
column in the table, like order by 1 asc?
David
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Wed, Mar 19, 2008 at 1:53 PM, David Giragosian [EMAIL PROTECTED] wrote:
Doesn't the 1 in Select count(1) from table refer to the first
column in the table, like order by 1 asc?
No, it evaluates to Boolean TRUE. It's the same as the one (1) here:
SELECT * FROM table WHERE 1;
--
-general@lists.php.net
Date: Wed, 19 Mar 2008 10:38:16 -0700 (PDT)
Subject: Re: [PHP] Fastest way to get table records' number
Hi,
did you try mysql_num_rows ?
--- Andrew Ballard [EMAIL PROTECTED] wrote:
On Wed, Mar 19, 2008 at 1:04 PM, TG
[EMAIL PROTECTED] wrote:
It seems that count
Nathan Nobbe wrote:
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard [EMAIL PROTECTED] wrote:
That works; I'm just wondering why you went with a count on an 'ID' column
rather than COUNT(*).
ouch, it looks like im horribly wrong :O
mysql select count(*) from table;
+--+
|
Nathan Nobbe wrote:
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard [EMAIL PROTECTED] wrote:
That works; I'm just wondering why you went with a count on an 'ID' column
rather than COUNT(*).
ouch, it looks like im horribly wrong :O
mysql select count(*) from table;
+--+
|
Nathan Nobbe wrote:
On Wed, Mar 19, 2008 at 9:42 AM, Andrew Ballard [EMAIL PROTECTED] wrote:
That works; I'm just wondering why you went with a count on an 'ID' column
rather than COUNT(*).
ouch, it looks like im horribly wrong :O
mysql select count(*) from table;
+--+
|
Hi all,
What do you think is the FASTEST sql to get the total number of a table
with millions of records?
--
Regards,
Shelley (http://phparch.cn)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Tue, Mar 18, 2008 at 11:43 PM, Shelley [EMAIL PROTECTED] 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'
25 matches
Mail list logo