Ok, Justin MacCarthy pointed out something for me to try.  He suggested
using count(cfid) instead of count(*) which would yield the same results.
This table has like 944 records btw, here are the results of time in ms
taken to run 1000 queries of each over 5 tries:

Using count(cfid): 3313
Using count(*): 3422

Using count(cfid): 3297
Using count(*): 3140

Using count(cfid): 3281
Using count(*): 3141

Using count(cfid): 3281
Using count(*): 3187

Using count(cfid): 3281
Using count(*): 3141

Hmm, the first try came out how I expected, but the other four leaned
towards count(*).  But really, 100 ms difference over 1000 runs is truly
insignificant, that is 0.1ms per query on the difference.  So, count(*) and
count(column) is handled the same at least in SQL Server.  If anyone has an
Oracle or other DB server running, I can pass the code along for running
this test over again.

Justin Kidman

-----Original Message-----
From: Justin Kidman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 06, 2000 9:24 AM
To: '[EMAIL PROTECTED]'
Subject: RE: count() or recordcount


Just ran a test using my CGLOBAL table that holds client variables in an
ODBC database.  Over 1000 loops of a query grabbing cfid and using
recordcount, it took 20031 ms of time.  To get the recordcount using the
count(*) method, over 1000 loops of the same table, it only took 3406 ms.
So, if you are only interested in the amount of rows, count(*) from SQL is
much better, but in most cases, you want data and a recordcount, there I
would use CF's RecordCount variable.

Justin Kidman

-----Original Message-----
From: Bud [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 06, 2000 9:12 AM
To: [EMAIL PROTECTED]
Subject: count() or recordcount


Which is faster? I'm presuming count() or what else would it be good for?
-- 

Bud Schneehagen - Tropical Web Creations

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to