That's really cool

Thanks

siomara


>From: "Eric Fitzgerald" <[EMAIL PROTECTED]>
>To: "Siomara Pantarotto" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
>Subject: Re: count(*) on different tables
>Date: Mon, 21 May 2001 14:08:00 -0700
>
>Well, let's do a test:
>
>mysql> CREATE TABLE testcount (product INT NOT NULL AUTO_INCREMENT PRIMARY
>KEY, description VARCHAR(50));
>Query OK, 0 rows affected (0.00 sec)
>
>**Ran perl script here to populate the table**
>mysql> SELECT * FROM testcount LIMIT 10;
>+---------+---------------+
>| product | description   |
>+---------+---------------+
>|       1 | Decription 1  |
>|       2 | Decription 2  |
>|       3 | Decription 3  |
>|       4 | Decription 4  |
>|       5 | Decription 5  |
>|       6 | Decription 6  |
>|       7 | Decription 7  |
>|       8 | Decription 8  |
>|       9 | Decription 9  |
>|      10 | Decription 10 |
>+---------+---------------+
>10 rows in set (0.03 sec)
>
>mysql> SELECT COUNT(*) FROM testcount;
>+----------+
>| COUNT(*) |
>+----------+
>|   100000 |
>+----------+
>1 row in set (0.00 sec)
>
>mysql> SELECT COUNT(1) FROM testcount;
>+----------+
>| COUNT(1) |
>+----------+
>|   100000 |
>+----------+
>1 row in set (0.00 sec)
>
>mysql> SELECT COUNT(2) FROM testcount;
>+----------+
>| COUNT(2) |
>+----------+
>|   100000 |
>+----------+
>1 row in set (0.00 sec)
>
>mysql> SELECT COUNT(*) FROM testcount WHERE product > 10;
>+----------+
>| COUNT(*) |
>+----------+
>|    99990 |
>+----------+
>1 row in set (0.32 sec)
>
>mysql> SELECT COUNT(1) FROM testcount WHERE product > 10;
>+----------+
>| COUNT(1) |
>+----------+
>|    99990 |
>+----------+
>1 row in set (0.32 sec)
>
>mysql>
>
>
>As you can see, it really makes no difference to MySQL.
>
>----- Original Message -----
>From: "Siomara Pantarotto" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
>Sent: Monday, May 21, 2001 1:48 PM
>Subject: Re: count(*) on different tables
>
>
> > Cool .... but how about if you put a where clause to your select??
> >
> > SQL> select count(1) from product where productid >3;
> >
> >   COUNT(1)
> > ----------
> >          7
> >
> > Would count(*) show the same performance as count(1)???
> >
> > Siomara
> >
> >
> > >From: "Eric Fitzgerald" <[EMAIL PROTECTED]>
> > >To: "Siomara Pantarotto" <[EMAIL PROTECTED]>, 
><[EMAIL PROTECTED]>
> > >Subject: Re: count(*) on different tables
> > >Date: Mon, 21 May 2001 13:11:38 -0700
> > >
> > >Actually, as far as performance goes, it depends on table types.  Most 
>of
> > >the MySQL table handlers keep an internal count of record numbers.  
>Thus,
>a
> > >select count(*) from table; is as fast as it gets.
> > >
> > >----- Original Message -----
> > >From: "Siomara Pantarotto" <[EMAIL PROTECTED]>
> > >To: <[EMAIL PROTECTED]>
> > >Sent: Monday, May 21, 2001 12:26 PM
> > >Subject: Re: count(*) on different tables
> > >
> > >
> > > > Well ...
> > > >
> > > > I don't know enough about mysql but it must allow you somehow to
>specify
> > >the
> > > > column by number as in Oracle and other DBs
> > > >
> > > > SQL> select count(*) from product;
> > > >
> > > >   COUNT(*)
> > > > ----------
> > > >         10
> > > >
> > > > SQL> select count(1) from product;
> > > >
> > > >   COUNT(1)
> > > > ----------
> > > >         10
> > > >
> > > > Once you just want to count the rows the performance of your select
>will
> > >be
> > > > much better if you specify a column rather than *.
> > > >
> > > > Siomara
> > > >
> > > >
> > > > >From: "Ansgar Becker" <[EMAIL PROTECTED]>
> > > > >To: <[EMAIL PROTECTED]>
> > > > >Subject: count(*) on different tables
> > > > >Date: Mon, 21 May 2001 20:18:35 +0200
> > > > >
> > > > >Hi,
> > > > >
> > > > >is it possible to get *one* quick result with the rowcount of each
> > >table
> > >in
> > > > >one database, without knowing the column-names?
> > > > >
> > > > >this does *not* work:
> > > > >  select count(t1.*), count(t2.*)
> > > > >    from table1 t1, table2 t2
> > > > >
> > > > >Manual doesn't say anything about that.
> > > > >
> > > > >Greetings,
> > > > >Ansgar Becker
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > 
> >---------------------------------------------------------------------
> > > > >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
> > > > >
> > > >
> > > >
> > 
> >_________________________________________________________________________
> > > > Get Your Private, Free E-mail from MSN Hotmail at
> > >http://www.hotmail.com.
> > > >
> > > >
> > > > 
>---------------------------------------------------------------------
> > > > 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
> > >
> >
> > 
>_________________________________________________________________________
> > Get Your Private, Free E-mail from MSN Hotmail at 
>http://www.hotmail.com.
> >
> >
> >
>
>
>---------------------------------------------------------------------
>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
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


---------------------------------------------------------------------
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