Hi All,<br><br>This issue is reported on trac (<a href="http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/6108">http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/6108</a>) and we have recently integrated the changes.<br><br><div>
<span class="gmail_quote">On 7/1/09, <b class="gmail_sendername">Lee Valentine</b> &lt;<a href="mailto:lee@leev.net">lee@leev.net</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Ding,<br> <br> That was just applied to 5.1rc2.&nbsp;&nbsp;However I did the query originally in 5.0.4.<br> <br> Thanks,<br> Lee<br> <br> <br> 2009/7/1 ding jianting &lt;<a href="mailto:dfar2008@gmail.com">dfar2008@gmail.com</a>&gt;:<br>
 <br>&gt; Hi,Lee<br> &gt; What is version of your vtigerCRM?<br> &gt;<br> &gt; On Wed, Jul 1, 2009 at 8:21 AM, Lee Valentine &lt;<a href="mailto:lee@leev.net">lee@leev.net</a>&gt; wrote:<br> &gt;&gt;<br> &gt;&gt; Hey Guys,<br>
 &gt;&gt;<br> &gt;&gt; We were having performance issues with the crm taking ages to load so<br> &gt;&gt; I had all the queries being executed printed to the screen with the<br> &gt;&gt; duration each query was taking.&nbsp;&nbsp;I found:<br>
 &gt;&gt;<br> &gt;&gt; select distinct(setype) from vtiger_crmentity where crmid in (select<br> &gt;&gt; parent_id from vtiger_troubletickets)<br> &gt;&gt; 106.894966125 seconds.<br> &gt;&gt;<br> &gt;&gt; I tracked this down to modules/CustomView/CustomView.php line 1212 (in<br>
 &gt;&gt; function getSalesRelatedName)<br> &gt;&gt; $sql = &quot;select distinct(setype) from vtiger_crmentity where crmid in<br> &gt;&gt; (select &quot;. $adb-&gt;sql_escape_string($fieldname).&quot; from &quot;.<br> &gt;&gt; $adb-&gt;sql_escape_string($tablename).&quot;)&quot;;<br>
 &gt;&gt;<br> &gt;&gt; I replaced it with the following:<br> &gt;&gt; $sql = &quot;select distinct(setype) from vtiger_crmentity c INNER JOIN<br> &gt;&gt; &quot;.$adb-&gt;sql_escape_string($tablename).&quot; t ON<br> &gt;&gt; t.&quot;.$adb-&gt;sql_escape_string($fieldname).&quot; = c.crmid&quot;;<br>
 &gt;&gt;<br> &gt;&gt; And received the result:<br> &gt;&gt; select distinct(setype) from vtiger_crmentity c INNER JOIN<br> &gt;&gt; vtiger_troubletickets t ON t.parent_id = c.crmid<br> &gt;&gt; 0.0270490646362 seconds.<br>
 &gt;&gt;<br> &gt;&gt; This has given our crm a MAJOR performance increase.<br> &gt;&gt;<br> &gt;&gt; Thanks,<br> &gt;&gt; Lee<br> &gt;&gt; _______________________________________________<br> &gt;&gt; Reach hundreds of potential candidates - <a href="http://jobs.vtiger.com">http://jobs.vtiger.com</a><br>
 &gt;<br> &gt;<br> &gt;<br> &gt; --<br> &gt; ________________________________________<br> &gt; 上海易客CRM 丁远<br> &gt; 地址:上海市徐汇区零陵路零陵路631号爱乐大厦<br> &gt; 电话:021-64876448&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;传真:021-64876441<br> &gt; 手机:(0)13701696656&nbsp;&nbsp;&nbsp;&nbsp; <a href="mailto:Email%3Adfar2008@gmail.com">Email:dfar2008@gmail.com</a><br>
 &gt; -----------------------------------------------------------------------<br> &gt;<br> &gt; _______________________________________________<br> &gt; Reach hundreds of potential candidates - <a href="http://jobs.vtiger.com">http://jobs.vtiger.com</a><br>
 &gt;<br> <br> _______________________________________________<br> Reach hundreds of potential candidates - <a href="http://jobs.vtiger.com">http://jobs.vtiger.com</a> </blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>
Asha<br>vtiger Team