<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Fixed - <a href="https://code.vtiger.com/vtiger/vtigercrm/issues/1743">https://code.vtiger.com/vtiger/vtigercrm/issues/1743</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 16, 2022 at 6:18 PM Prasad <<a href="mailto:prasad@vtiger.com">prasad@vtiger.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">It's a slip - thanks for catching it. Please file an issue on the <a href="https://code.vtiger.com/vtiger/vtigercrm" target="_blank">tracker</a>.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 15, 2022 at 8:12 AM Rubén A. Estrada Orozco <<a href="mailto:rulotec1@gmail.com" target="_blank">rulotec1@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>There's this table: vtiger_inventorychargesrel</div><div>When creating an invoice (I suspect the same applies for other inventory modules), a query like this gets executed several times:</div><div><br></div><div>SELECT * FROM vtiger_inventorychargesrel WHERE recordid = 4535638<br></div><div><br></div><div>On a large DB with 1.5 million records on that table, each such query takes ~0.6 seconds. The creation of a single invoice was taking around 6 seconds.</div><div><br></div><div>The table is created here modules/Migration/schema/660_to_700.php with this query:</div><div>CREATE TABLE vtiger_inventorychargesrel(recordid INT(19) NOT NULL, charges TEXT)<br></div><div><br></div><div>As far as I can tell, there should be a single record per invoice, so I added a primary key with:</div><div>ALTER TABLE vtiger_inventorychargesrel ADD PRIMARY KEY(recordid)</div><div><br></div><div>After that, creation of new invoices was taking 300 milliseconds instead of 6 seconds.</div><div><br></div><div>Why was that table created without a primary key or an index? Was it just overlooked / forgotten or is there a good reason for it?</div><div><br clear="all"><div><div dir="ltr"><div dir="ltr">Saludos<div><br></div><div>Rubén</div></div></div></div></div></div>
_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div>
</blockquote></div>