Using Block Factoring

Data retrieved from a database is usually returned (to ColdFusion and any other database client) one row at a time. You can control the number of rows sent per request using the tag’s BLOCKFACTOR attribute – the default is 1 and you can specify any number from 1 to 100. For example, if you retrieve 50 rows and BLOCKFACTOR=”10″ then 5 requests will be made to the database server instead of 50. So when should you use this feature? Use it any time you know (or at least expect with reasonable certainty) that a query will return multiple rows, If you expect hundreds or thousands of rows back then set BLOCKFACTOR=”100″, if you expect less rows then make an educated guess. But don’t go to the extreme of always using a large BLOCKFACTOR – specifying a BLOCKFACTOR that is too large can hurt query performance, possibly doing more harm than not having used BLOCKFACTOR in the first place. (Applies to: ColdFusion 4 (or later))

Leave a Reply