Highlighted

Performance while checking record count of a query object

Explorer ,
Mar 26, 2015

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.

Views

496

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Performance while checking record count of a query object

Explorer ,
Mar 26, 2015

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.

Views

497

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 26, 2015 0
haxtbh LATEST
Advocate ,
Mar 27, 2015

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 27, 2015 0