Re: Which "select " is fast,thanks....... ?

From: Date: Sun, 17 Mar 2002 01:48:23 +0000
Subject: Re: Which "select " is fast,thanks....... ?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17718@lists.php.net to get a copy of this message
#1 is the fastest with MySQL. (copied from MySQL online docs...) Glenn a.. COUNT(*) on a single table without a WHERE is retrieved directly from the table information for MyISAM and HEAP tables. This is also done for any NOT NULL expression when used with only one table. ..... examples of queries that are very fast: mysql> SELECT COUNT(*) FROM tbl_name; The following queries are resolved using only the index tree (assuming the indexed columns are numeric): mysql> SELECT COUNT(*) FROM tbl_name -> WHERE key_part1=val1 AND key_part2=val2; "K ®r[" <fongming@host1.tyes.tyc.edu.tw> wrote in message news:002b01c1ccfb$c9f94a20$0200a8c0@hinet... Hi,all friends: Would you please tell me which script in MySQL is fast? --------------------------------------------- 1. select count(*) from bk_data 2. select count(book_name) from bk_data --------------------------------------------- PS. I have 13000 book records in this table..... Fongming from Taiwan, thanks

« previous php.db (#17718) next »