Simon
09/12/2025, 12:01 AMselect top 1 c.id from customer c
select c.id from customer c where rownum <= 1
is one faster than the other? Some of our clients the query will timeout.
The situation is we're trying to detect if custom fields exist on an object and from what we've gathered, we need NetSuite to actually return 1 row so it'll process the proper validations... as in, we can't do select c.bad_field from customer c where 1 = 2 it'll return an empty set and not error out. If we do select top 1 c.bad_field from customer c it'll error out, but for some of our clients, this times out.michoel
09/12/2025, 6:54 AMcustomfield table you can querySimon
09/12/2025, 3:26 PMcustomfield table would be a pain, but I think overall rearchitecting things to use that table is probably best.
Do you know if there's a way to get the list of all built-in columns for a given NS table?Pandorahiccup
09/12/2025, 7:00 PMTOP 1 and WHERE ROWNUM <= 1 push through the same engine, so there isn’t a real performance difference. The timeouts you’re seeing usually come from the query planner scanning too much data before it applies the limit.
If your goal is just to trigger validation on a column, the best practice is to use SELECT TOP 1 with a very selective condition like WHERE isinactive = 'F' or any indexed field so SuiteQL can short-circuit faster. That way you still force NetSuite to evaluate the field but reduce the chance of a full table scan that causes timeouts.Simon
09/12/2025, 11:16 PM