Hi.
COUNT(*) is optimised to return the result very quickly for MyISAM tables, as the quantity of rows is stored and updated separately. (Not true for other table types, though). So in most cases use it. Rob Best <[EMAIL PROTECTED]> wrote: > I have a database that contains a cable of 'customers'. 'Customers' > does not change on a regular basis but is queried frequently so I have > setup a 'customers_cache' table, which is exactly the same as > 'customers', except 'customers_cache' is a memory based table. Before > doing a query on 'customers_cache' I always do a: SELECT COUNT (*) > from customers_cache > > If I get a result > 0, then I assume the customers_cache table is > valid. If it is not, I copy all of the data from 'customers' into > 'customers_cache' and then start over. > > I've had this help quite a bit, but of course I'm doing the query... > SELECT COUNT (*) from customers_cache > > a lot. Of course the query is fast but since I do it SO much, I was > wondering if anyone had a suggestion of a FASTER method of checking to > see if a table has any records in it. > > mysql version 4.0.22 (soon to move to 4.1.x) > MacOS X Server 10.3.5 > accessing via php 4.x & apache 1.3.x > > > Thanks! > > > Robert C. Best III - [EMAIL PROTECTED] > District Technology Coordinator > for N.E.R.I.C. at Potsdam Central School > Phone: (315) 265-2000 x266 > > -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]