Hey folks, my team has begun the process of conver...
# suiteql
s
Hey folks, my team has begun the process of converting legacy SuiteAnalytics Connect queries/reporting to SuiteQL (datasource Netsuite2.com) and I'm finding query completion times range from not-very-fast to painfully-slow compared to legacy queries with the old schema (datasource Netsuite.com) I've got a ticket escalated so that Netsuite can work with me on solving this issue, but I thought I'd ask here to determine if others have experienced this when they first began working with the newer datasource? Here's are some example queries:
Copy code
select count(*) from transaction where recordtype= 'salesorder'
^ This query takes 15 minutes to complete lolcry.
Copy code
SELECT
SUM(-tl.NetAmount) as Amount,
SUM(-tl.Quantity) as Quantity,
tl.Item
FROM
Transaction t
JOIN TransactionLine tl ON t.Id = tl.Transaction
JOIN ItemVendor iv ON tl.Item = iv.Item
JOIN Vendor v ON iv.vendor= v.id
WHERE
v.entityid = '15316'
AND iv.subsidiary = 1
AND t.TranDate >= TO_DATE('02/29/2024', 'mm/dd/yyyy')
GROUP BY
tl.Item
^ This takes 15 minutes. With similar old school Netsuite.com datasource queries both of these would complete within a few seconds. Here is my Linux Netsuite ODBC driver config for this connection: [NetSuite2] Driver=/opt/netsuite/odbcclient/lib64/ivoa27.so Description=Connect to your NetSuite account Host=3669980.connect.api.netsuite.com Port=1708 ServerDataSource=NetSuite2.com Encrypted=1 Truststore=/opt/netsuite/odbcclient/cert/ca3.cer CustomProperties=AccountID=3669980;RoleID=1048 StaticSchema=1 AllowSinglePacketLogout=1 IANAAppCodePage=106 Thanks in advance for any insight y'all may have.
👀 2
t
@Sean Pecor In that second query, instead of joining to Vendor, maybe join to Entity. For example:
Copy code
SELECT
    TransactionLine.Item,
    ( SUM( TransactionLine.NetAmount ) * -1 ) AS Amount,
    ( SUM(TransactionLine.Quantity ) * -1 ) AS Quantity
FROM
    Transaction
    INNER JOIN TransactionLine ON
       ( TransactionLine.Transaction = Transaction.ID )
    INNER JOIN ItemVendor ON
       ( ItemVendor.Item = TransactionLine.Item )
        AND ( ItemVendor.Subsidiary = 1 )
    INNER JOIN Entity AS Vendor ON
       ( Vendor.ID = ItemVendor.Vendor )
WHERE
    ( Transaction.TranDate >= TO_DATE( '2024-02-29', 'YYYY-MM-DD' ) )
    AND ( Vendor.EntityID = '15316')
GROUP BY
    TransactionLine.Item
And in the first query, this might work a little better:
Copy code
select count(ID) from transaction where recordtype= 'salesorder'
In other words, I'd try to avoid using COUNT(*).
Hope this helps.
🙌 1
s
You can also try using a date literal instead of TO_DATE, i.e.
transaction.trandate >= DATE '2024-02-09'