Has anybody seen that squiteql is actually faster ...
# suitescript
m
Has anybody seen that squiteql is actually faster than searches? I've been running tests and anytime it's a multiple paged result, searches have been faster through my tests. I've tried to optimize the parsing of the results as much as possible to return the results in a JSON format. The iterator that the netsuite help uses as an example is usually much slower. Below are the helper functions i'm running to run the query and parse the results
Copy code
lib.query = (options) => {
        return lib.parseSqlPagedResults((query.runSuiteQLPaged({
            query: options.sql,
            pageSize: options.pageSize || 5000,
        })));
    };
    lib.parseSqlPagedResults = (response) => {
        let results = [];
        response.pageRanges.forEach((page, pageIndex) => {
            response.fetch(pageIndex).data.results.forEach((rowObj) => {
                results.push(rowObj.asMap());
            });
        });
        return results;
    };
c
I use N/query module for just about everything. I hate the N/search module because it’s so much extra boilerplate code and, as you stated, getting all the object fields in JSON format is burdensome
Have you tried asMappedResults? that is extremely fast for me.
Copy code
query.runSuiteQL({query: querystring).asMappedResults()
m
@Cory Weiner will that return all results if there are more than 5000 allowed per page?