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>
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;
+--+
| c
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;
+--+
| c
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;
+--+
| c
To: PHP General list
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
&g
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;
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
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'
> colum
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.
>
>
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
"
Date: Wed, 19 Mar 2008 10:35:16 -0400
Subject: Re: [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' c
> > > 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,
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
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:
> > >
>
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 t
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 horribl
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 horri
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 ta
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
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(*) |
+--+
| 3
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 document
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 num
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 = "S
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
24 matches
Mail list logo