Sean Pecor
08/27/2024, 6:43 PMselect count(*) from transaction where recordtype= 'salesorder'
^ This query takes 15 minutes to complete lolcry.
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.tdietrich
08/27/2024, 9:19 PMSELECT
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
tdietrich
08/27/2024, 9:21 PMselect count(ID) from transaction where recordtype= 'salesorder'
In other words, I'd try to avoid using COUNT(*).tdietrich
08/27/2024, 9:21 PMShai Coleman
08/28/2024, 10:45 PMtransaction.trandate >= DATE '2024-02-09'