Performance while checking record count of a query object
Copy link to clipboard
Copied
I can check whether a query results contains any record count or not in any of the following ways.
1 <cfif myQueryObject.recordCount>
---- some logic ----
</cfif>
2 <cfif myQueryObject.recordCount GT 0>
---- some logic ----
</cfif>
Can any one guide me saying which one will provide a better performance.
Your timely help is well appreciated.
Copy link to clipboard
Copied
There will be no noticeable performance difference between then two of these. They are pretty much exactly the same except one is checking the boolean state and the other the actual value. I don't think you could even measure the difference in performance with it being so small, IF there even was a difference.
Your usage will come down to the standard you are using. Stick to one throughout. Like you say both are viable options to checking the result.

