Hi,Lee<br>What is version of your vtigerCRM?<br><br><div class="gmail_quote">On Wed, Jul 1, 2009 at 8:21 AM, Lee Valentine <span dir="ltr">&lt;<a href="mailto:lee@leev.net">lee@leev.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Hey Guys,<br>
<br>
We were having performance issues with the crm taking ages to load so<br>
I had all the queries being executed printed to the screen with the<br>
duration each query was taking. &nbsp;I found:<br>
<br>
select distinct(setype) from vtiger_crmentity where crmid in (select<br>
parent_id from vtiger_troubletickets)<br>
106.894966125 seconds.<br>
<br>
I tracked this down to modules/CustomView/CustomView.php line 1212 (in<br>
function getSalesRelatedName)<br>
$sql = &quot;select distinct(setype) from vtiger_crmentity where crmid in<br>
(select &quot;. $adb-&gt;sql_escape_string($fieldname).&quot; from &quot;.<br>
$adb-&gt;sql_escape_string($tablename).&quot;)&quot;;<br>
<br>
I replaced it with the following:<br>
$sql = &quot;select distinct(setype) from vtiger_crmentity c INNER JOIN<br>
&quot;.$adb-&gt;sql_escape_string($tablename).&quot; t ON<br>
t.&quot;.$adb-&gt;sql_escape_string($fieldname).&quot; = c.crmid&quot;;<br>
<br>
And received the result:<br>
select distinct(setype) from vtiger_crmentity c INNER JOIN<br>
vtiger_troubletickets t ON t.parent_id = c.crmid<br>
0.0270490646362 seconds.<br>
<br>
This has given our crm a MAJOR performance increase.<br>
<br>
Thanks,<br>
Lee<br>
_______________________________________________<br>
Reach hundreds of potential candidates - <a href="http://jobs.vtiger.com" target="_blank">http://jobs.vtiger.com</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>________________________________________<br>上海易客CRM 丁远<br>地址:上海市徐汇区零陵路零陵路631号爱乐大厦<br>电话:021-64876448 &nbsp; &nbsp; &nbsp; &nbsp;传真:021-64876441<br>手机:(0)13701696656 &nbsp; &nbsp; <a href="mailto:Email%3Adfar2008@gmail.com">Email:dfar2008@gmail.com</a><br>

-----------------------------------------------------------------------<br>