-
Notifications
You must be signed in to change notification settings - Fork 33
LC0082
Arthur van de Vondervoort edited this page Dec 19, 2024
·
3 revisions
Using Rec.Count()
to determine if a table has exactly one or more records can cause significant performance issues, especially on large tables, as it triggers a full table or index scan.
For a more efficient approach, use a combination of Rec.Find('-')
and Rec.Next()
. This method minimizes database load by stopping after finding the necessary records, for faster and more efficient record checks.
if Rec.Count() = 1 then
Should be replaced by
if Rec.Find('-') and (Rec.Next() = 0) then
if Rec.Count() > 1 then
Should be replaced by
if Rec.Find('-') and (Rec.Next() <> 0) then