<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
span.EmailStyle19
        {mso-style-type:personal-compose;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-AU link=blue vlink=purple>

<div class=Section1>

<p class=MsoPlainText>Hi Steve,<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Use HELP TABLE to make sure the statistics are recorded
against the columns in the SELECT and WHERE clause.<o:p></o:p></p>

<p class=MsoPlainText style='margin-left:36.0pt'>sql db1 &lt;&lt;eof &gt;
db1.txt<o:p></o:p></p>

<p class=MsoPlainText style='margin-left:36.0pt'>help table tablename \g\q<o:p></o:p></p>

<p class=MsoPlainText style='margin-left:36.0pt'>eof<o:p></o:p></p>

<p class=MsoPlainText style='margin-left:36.0pt'><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText style='margin-left:36.0pt'>sql db2 &lt;&lt;eof &gt;
db2.txt<o:p></o:p></p>

<p class=MsoPlainText style='margin-left:36.0pt'>help table tablename \g\q<o:p></o:p></p>

<p class=MsoPlainText style='margin-left:36.0pt'>eof<o:p></o:p></p>

<p class=MsoPlainText style='margin-left:36.0pt'><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText style='margin-left:36.0pt'>diff db1.txt db2.txt<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Double check all tables and indexes from the query are
configured the same: column data type, page size, storage, primary keys,
foreign key constraints.<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Run optimizedb -zc -zk dbname -rtablename <o:p></o:p></p>

<p class=MsoPlainText>Run statdump dbname -rtablename<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Does the QEP show a timeout?<o:p></o:p></p>

<p class=MsoPlainText>Compare the configuration of the servers: <o:p></o:p></p>

<p class=MsoPlainText>degree_of_parallelism<o:p></o:p></p>

<p class=MsoPlainText>opf_hash_aggregate<o:p></o:p></p>

<p class=MsoPlainText>opf_hash_join <o:p></o:p></p>

<p class=MsoPlainText>opf_greedy_factor<o:p></o:p></p>

<p class=MsoPlainText>opf_joinop_timeout<o:p></o:p></p>

<p class=MsoPlainText>qflatten_aggregate<o:p></o:p></p>

<p class=MsoPlainText>qflatten_singleton<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Perhaps send a copy of the select and QEPs.&nbsp; <o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Paul<o:p></o:p></p>

<p class=MsoPlainText>&amp;<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText><span lang=EN-US>-----Original Message-----<br>
From: info-ingres-bounces@lists.planetingres.org [mailto:info-ingres-bounces@lists.planetingres.org]
On Behalf Of s.anderson.au@gmail.com<br>
Sent: Thursday, 15 August 2019 10:48 AM<br>
To: info-ingres@lists.planetingres.org<br>
Subject: [Info-ingres] Comparing QEPs</span><o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Hi there<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Had an issue where a query in one ABF screen started
running very slowly, instead of completing instantly, it now takes twenty
seconds.<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Re-generating the statistics for the associated tables
did not help.<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>As such I copied the tables to our dev box and compared
the query plans Ingres created on dev vs production. On production the QEP did
not utilise a secondary index, whereas on dev it did.<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>The dev vs production is not a perfection comparison as
in the process of copying the tables across to dev, the tables were rebuilt.<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>I tried to force Ingres to use the secondary index by
tweaking the query to explicitly join with the secondary index, but my hack did
not help.<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>What is the best approach for this situation? Should I be
rebuilding the tables involved?<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Thanks<o:p></o:p></p>

<p class=MsoPlainText>Steve<o:p></o:p></p>

<p class=MsoPlainText>_______________________________________________<o:p></o:p></p>

<p class=MsoPlainText>Info-ingres mailing list<o:p></o:p></p>

<p class=MsoPlainText>Info-ingres@lists.planetingres.org<o:p></o:p></p>

<p class=MsoPlainText>https://lists.planetingres.org/mailman/listinfo/info-ingres<o:p></o:p></p>

</div>

</body>

</html>