Not the answer you need?
Register and ask your own question!

My Sql Query very slow

selvaselva EntrantCurrent User Role Beginner
Hi, some one help me please, I have below query , It is very very slow just 1000 Records it taking 10 minits

SELECT DISTINCT
vtiger_salesorder.salesorder_no,
vtiger_salesorder.salesorderid,
vtiger_salesorder.orderdate,
vtiger_salesorder.invoicedate,
vtiger_salesorder.invoiceno,

(SELECT
softMax_events.description
FROM
softMax_events
WHERE vtiger_salesorder.salesorderid = softMax_events.orderNum
AND softMax_events.appointTyp='60' AND softMax_events.status = '0' Limit 0,1) As daterequirednotes,

(SELECT
DATE_FORMAT(softMax_events.s_date,'%d-%m-%Y')
FROM
softMax_events
WHERE vtiger_salesorder.salesorderid = softMax_events.orderNum
AND softMax_events.appointTyp='60' AND softMax_events.status = '0' Limit 0,1) As AppDateReq,

(SELECT
DATE_FORMAT(softMax_events.s_date,'%d-%m-%Y')
FROM
softMax_events
WHERE vtiger_salesorder.salesorderid = softMax_events.orderNum
AND softMax_events.appointTyp='61' AND softMax_events.status = '0' Limit 0,1) As FITTERDate


FROM
vtiger_salesorder
INNER JOIN vtiger_inventoryproductrel ON vtiger_inventoryproductrel.id = vtiger_salesorder.salesorderid
Inner Join vtiger_crmentity ON vtiger_salesorder.salesorderid = vtiger_crmentity.crmid
WHERE (vtiger_salesorder.sostatus = 'Order') and ( vtiger_crmentity.deleted<>'1')

Comments

  • rreddyrreddy Contributor Current User Role Beginner
    Selva, You need to provide at least the "show create table" and "show table status" for all the tables involved without that information, there is very little anyone can offer you.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.