In news:[EMAIL PROTECTED],
Shadow [EMAIL PROTECTED] wrote:
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.
You may add an index on `items`.`ctg` if there is none.
Maciek
--
ctg='ctg' GROUP BY ctg;
- Original Message -
From: Shadow [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Thursday, March 29, 2007 6:59 PM
Subject: Querying large table
Hey, guys.
I have 2 tables: categories and items.
COUNT(*) categories = 63 833
COUNT(*) items = 742 993
I need
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
)
-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
scan on items because there isn't an
index define for ctg on the items TABLE.
Again, just one man's thought.
-Original Message-
From: Michael Gargiullo [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 29, 2007 6:10 PM
To: Shadow; mysql@lists.mysql.com
Subject: RE: Querying large table