Mysql - How to Optimize Retrieval Time in a Table I have query which has 200 million Records in a single table. I am using BTree indexes in my table:

mysql&gt; select COUNT(DISTINCT id) from [tablename] where [columname] &gt;=3;  
+------------------------------+  
| COUNT(DISTINCT id) |  
+------------------------------+  
|    8242063  
+------------------------------+  
1 row in set (3 min 23.53 sec)


I am not satisfy with this timing.

How can I reduce the result time less than 30sec. Kindly give me any suggessions! It will be more helpful to me!
Maybe GROUP BY can help. See this MySQL reference on DISTINCT optimization

SELECT COUNT(*)
FROM (
  SELECT 1
  FROM [tablename]
  WHERE [columnname] &gt;= 3
  GROUP BY id
) q