Do you need a count for all and run one at a time? If so, try. Select ctg as catagory,count(*) as count from items group by catagory. It will take a little while to run, but return all of your counts.
Does the items table have an index in ctg? Sent by Good Messaging (www.good.com) -----Original Message----- From: Shadow [mailto:[EMAIL PROTECTED] Sent: Thursday, March 29, 2007 07:00 PM Eastern Standard Time To: mysql@lists.mysql.com Subject: Querying large table Hey, guys. I have 2 tables: categories and items. COUNT(*) categories = 63 833 COUNT(*) items = 742 993 I need to get number of items in a specific category, so I use SELECT COUNT(*) FROM items WHERE ctg='<ctg>' But each query takes ~ 10seconds. Its really slow. Can anybody propose some optimization? Thanks. --------------------------------- Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.