NYCPHP Meetup

NYPHP.org

[nycphp-talk] mySQL optimization question.

Nasir Zubair lists at ny-tech.net
Tue May 27 21:01:54 EDT 2003


Thanks adam and everyone else. :-)
 
- Nasir 
 
-------Original Message-------
 
From: talk at nyphp.org
Date: Tuesday, May 27, 2003 1:10:02 PM
To: NYPHP Talk
Subject: RE: [nycphp-talk] mySQL optimization question.
 
On Tue, 27 May 2003, Malcolm, Gary wrote:
 
> 1. don't use count(*) because mysql will pull all fields for every record.
.
> use $result = mysql_query("SELECT count(col_name) FROM table_name");
>
> 2. db's are optimized for this query so their return is like greased
> lightening :)
>
> 3. let the db do the work!
 
4. You want to send as little information between the database and PHP
as possible because it's faster. Having mySQL do the count means
you're sending a number instead of a whole bunch of text. (This
isn't such a big deal here, since the amount of text is small.)
 
-adam
 
--
adam at trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!
 
 
 
--- Unsubscribe at http://nyphp.org/list/ ---
 
 
 
 
.




More information about the talk mailing list