[thelist] ColdFusion Tip

Daniel J. Cody dcody at oracular.com
Thu Jun 1 11:25:25 2000


rudy limeback wrote:
> 
> > Use the 'maxrows' attribute in your cfquery tag set to 1; it will speed
> > the query up (database stops searching after it finds the first match)
> 

> if there is no way for cf to stop the database from sending all the result
> blocks, then i suppose cf just ignores the ones it doesn't want -- less
> efficient, but gets the job done, probably doesn't fill up any cf buffers
> needlessly, etc.
> 
> note that in both cases the database doesn't "stop searching" -- it's
> already done its full search the moment it was given your sql to execute!
> 
> nevertheless, i think you're right seth, using maxrows has to be more
> efficient than not using it
> 
> ;o)
> 
> any real cf internals folks out there can refute/verify any of this?  did
> any of this make sense?

You're right on the money rudy. I was going to say something about it
yesterday, but lost track of the email..

Using a DB's native functions(you mentioned the 'top' of access) to
limit the number of rows is always a good idea. 

One thing that could be used is the 'blockfactor' attribute of <cfquery>
It specifies the max # of rows to fetch from the DB at a time. It works
with the Oracle native driver and supposedly some ODBC drivers. Its a
little know attribute, but can *greatly* improve query performance.. Its
default is only 1, so if you have 1000 records returned, its sending
1000 chunks of data. Setting a blockfactor to something like 100 in that
case would send 10 chunks of 100 rows, which is better for performance.

My little helpful tip for the day ;)

.djc.