Re: number of rows in mysql...

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

 



In message <20060729105954.28414.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxx>, z.
shafiee <z.shafiee@xxxxxxxxx> writes
>no 
>  when u want to count number of rows in database without fetch record, what do 
>u do ?
>  if i fetch record and then use mysql_rows_num function, it is not correct.

You are correct.

>  ur idea about "select * count..." is very good.

If you "SELECT * FROM table", it takes much longer than "SELECT (*) FROM
table".

The rule should be, only ever ask for what you need, and no more.  

"SELECT * FROM table" brings back every field and every record in the
table.  That could be thousands or millions of fields.

"SELECT (*) FROM table" looks at the underlying information about the
table, which is kept in a system table, which is not normally directly
accessible.  This table has a column which contains the rows - the
number of records - for each table.  This means that you only get one
field back.


-- 
Pete Clark

Andalucia in Sunny Southern Spain
http://www.hotcosta.com/comm_1.htm



PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux