Re: Slow Query
My apologies please find queries below.
SELECT
vtiger_contactscf.cf_632,
vtiger_contactdetails.firstname,
vtiger_contactdetails.lastname,
vtiger_contactscf.cf_1425,
vtiger_contactdetails.email,
vtiger_contactscf.cf_630,
vtiger_contactscf.cf_634,
vtiger_contactdetails.mobile,
vtiger_contactscf.cf_744,
vtiger_contactdetails.contactid,
vtiger_crmentity_user_field.starred
FROM
vtiger_contactdetails
INNER JOIN vtiger_crmentity ON vtiger_contactdetails.contactid = vtiger_crmentity.crmid
INNER JOIN vtiger_contactscf ON vtiger_contactdetails.contactid = vtiger_contactscf.contactid
LEFT JOIN vtiger_crmentity_user_field ON vtiger_contactdetails.contactid = vtiger_crmentity_user_field.recordid
AND vtiger_crmentity_user_field.userid = N
LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id
LEFT JOIN vtiger_groups ON vtiger_crmentity.smownerid = vtiger_groups.groupid
WHERE
vtiger_crmentity.deleted = N
AND (
(
(
(
trim(
CONCAT(
vtiger_users.first_name,
'S',
vtiger_users.last_name
)
) = 'S'
or vtiger_groups.groupname = 'S'
)
)
)
)
AND vtiger_contactdetails.contactid > N
ORDER BY
vtiger_crmentity.modifiedtime DESC
LIMIT
N, N
SELECT
vtiger_contactdetails.firstname,
vtiger_contactdetails.lastname,
vtiger_contactdetails.title,
vtiger_contactdetails.email,
vtiger_crmentity.smownerid,
vtiger_contactdetails.contactid,
vtiger_crmentity_user_field.starred
FROM
vtiger_contactdetails
INNER JOIN vtiger_crmentity ON vtiger_contactdetails.contactid = vtiger_crmentity.crmid
LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id
LEFT JOIN vtiger_groups ON vtiger_crmentity.smownerid = vtiger_groups.groupid
LEFT JOIN vtiger_crmentity_user_field ON vtiger_contactdetails.contactid = vtiger_crmentity_user_field.recordid
AND vtiger_crmentity_user_field.userid = N
WHERE
vtiger_crmentity.deleted = N
AND vtiger_contactdetails.contactid > N
ORDER BY
vtiger_crmentity.modifiedtime DESC
LIMIT
N, N
SELECT
vtiger_contactdetails.firstname,
vtiger_contactdetails.lastname,
vtiger_contactdetails.title,
vtiger_contactdetails.email,
vtiger_crmentity.smownerid,
vtiger_contactdetails.contactid,
vtiger_crmentity_user_field.starred
FROM
vtiger_contactdetails
INNER JOIN vtiger_crmentity ON vtiger_contactdetails.contactid = vtiger_crmentity.crmid
LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id
LEFT JOIN vtiger_groups ON vtiger_crmentity.smownerid = vtiger_groups.groupid
LEFT JOIN vtiger_crmentity_user_field ON vtiger_contactdetails.contactid = vtiger_crmentity_user_field.recordid
AND vtiger_crmentity_user_field.userid = N
WHERE
vtiger_crmentity.deleted = N
AND vtiger_contactdetails.contactid > N
ORDER BY
vtiger_crmentity.modifiedtime DESC
LIMIT
N, N