Skip to main content
Inspiring
March 27, 2015
Question

Performance while checking record count of a query object

  • March 27, 2015
  • 1 reply
  • 637 views

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.

This topic has been closed for replies.

1 reply

Inspiring
March 27, 2015

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.