Is one netsuite search call usually faster than pu...
# suitescript
h
Is one netsuite search call usually faster than pulling two records? For example if I had two items in netsuite and needed to grab their prices, would it be advantages to do a search call instead of calling each item for data? If not, when does this become advantages? - please excuse my bad terminology
n
For two records i think you wouldnt notice any difference in speed, But yes generally searching would be faster than loading the records. Using the query module is actually faster than a saved search too if you can get the hang of using it. But the main advantage comes from governance. Each script has a governance limit and running a search/query is cheaper than loading a record.
h
@Nathan L THANK YOU, you have been a great help. Trying to learn best practices as I go.
🫡 1
s
a reasonable rule of thumb is if you are only reading from other records, use search.
this 1
s
From those guidelines:
Copy code
For record Create or Edit operations, you should load records in dynamic mode. This is required to make updates on record object.
Really?
👀 1
s
no, you should avoid dynamic mode unless you have no other choice.
❤️ 1
s
i have found that a query or search tends to always beat the speed of a record load, even for a single record. Maybe for a very small custom record they’d be equal, but I can’t think of any time I’ve seen a record load be faster than a search or query.
s
I'd agree with Scott, assuming the search is against internal id (which I assume is PK) or another indexed column.