-
Notifications
You must be signed in to change notification settings - Fork 32
LC0081
Arthur van de Vondervoort edited this page Dec 14, 2024
·
2 revisions
The Rec.Count()
function can be an expensive operation, especially on large tables, as it performs a full table or index scan to count all records in the database. This can significantly degrade performance and unnecessarily load the database.
Instead of Rec.Count() to check for the presence of records, use the more efficient Rec.IsEmpty()
function. Unlike Rec.Count(), Rec.IsEmpty() stops immediately after finding a single record, reducing database load and improving performance.
if Rec.Count() = 0 then
Should be replaced by
if Rec.IsEmpty() then
if Rec.Count() > 0 then
Should be replaced by
if not Rec.IsEmpty() then