You should use a field name in the count instead of the *.  It should
speed it up.
SELECT COUNT( fieldname ) FROM myTable 
With the * it has to return all records and all fields.  


-----Original Message-----
From: Jeremy Bunton [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 17, 2006 9:28 AM
To: CF-Talk
Subject: Large count query > caching

I have a query counting records in a 25 million plus database. Even with
indexing and what not it takes about 25 seconds to run this query.
(count * from table where date > 19000101) Is there a way I could cache
the query so that if it is ran in that same way it very quickly returns
the full count.
I.E. this is a dynamically build query so sometimes it will have a long
where clause that I may be different than the straight just count
everything thing  like above. It seems to me that if that query has been
ran one time in the same way that query should not have to recount the
next time, and should just output the count. 

Jeremy 






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235626
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to