<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:x="urn:schemas-microsoft-com:office:excel" 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 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* 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;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></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-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Our mysqld was rather swamped today, when I looked at the queries waiting to run, most were of the form below.
<o:p></o:p></p>
<p class="MsoNormal">It seems to only select the eprintid, while the where clause itself contains the eprintid it is trying to retrieve, and contains quite a number of sub-select queries.
<o:p></o:p></p>
<p class="MsoNormal">Is there a reason for these queries (does it confirm the existence / validity of a record by selecting all the relevant sub-tables)?
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:8.0pt">SELECT `eprint`.`eprintid` FROM `eprint`,
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> (SELECT `eprint`.`eprintid` AS `eprintid` FROM `eprint`,
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> (SELECT `eprint`.`eprintid` AS `eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> FROM `eprint`, `eprint_divisions` AS `eprint_divisions`, `subject_ancestors` AS `243327284subject_ancestors`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> WHERE `eprint`.`eprintid`=`eprint_divisions`.`eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> AND `eprint_divisions`.`divisions`=`243327284subject_ancestors`.`subjectid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> AND `243327284subject_ancestors`.`ancestors` = 's921'
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> UNION SELECT `eprint`.`eprintid` AS `eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> FROM `eprint`, `eprint_divisions` AS `eprint_divisions`, `subject_ancestors` AS `243401584subject_ancestors`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> WHERE `eprint`.`eprintid`=`eprint_divisions`.`eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> AND `eprint_divisions`.`divisions`=`243401584subject_ancestors`.`subjectid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> AND `243401584subject_ancestors`.`ancestors` = 'd881'
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> UNION SELECT `eprint`.`eprintid` AS `eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> FROM `eprint`, `eprint_divisions` AS `eprint_divisions`, `subject_ancestors`
AS `243264652subject_ancestors` <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> WHERE `eprint`.`eprintid`=`eprint_divisions`.`eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> AND `eprint_divisions`.`divisions`=`243264652subject_ancestors`.`subjectid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> AND `243264652subject_ancestors`.`ancestors` = 'd2011'
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> UNION SELECT `eprint`.`eprintid` AS `eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> FROM `eprint`, `eprint_divisions` AS `eprint_divisions`, `subject_ancestors`
AS `243315308subject_ancestors` <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> WHERE `eprint`.`eprintid`=`eprint_divisions`.`eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> AND `eprint_divisions`.`divisions`=`243315308subject_ancestors`.`subjectid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> AND `243315308subject_ancestors`.`ancestors` = 'd2791'
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> UNION SELECT `eprint`.`eprintid` AS `eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> FROM `eprint`, `eprint_divisions` AS `eprint_divisions`, `subject_ancestors`
AS `243676804subject_ancestors` <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> WHERE `eprint`.`eprintid`=`eprint_divisions`.`eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> AND `eprint_divisions`.`divisions`=`243676804subject_ancestors`.`subjectid`
AND `243676804subject_ancestors`.`ancestors` = 'd2012' <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> UNION SELECT `eprint`.`eprintid` AS `eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> FROM `eprint`, `eprint_divisions` AS `eprint_divisions`, `subject_ancestors`
AS `243713020subject_ancestors` <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> WHERE `eprint`.`eprintid`=`eprint_divisions`.`eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> AND `eprint_divisions`.`divisions`=`243713020subject_ancestors`.`subjectid`
AND `243713020subject_ancestors`.`ancestors` = 'd904' <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> UNION SELECT `eprint`.`eprintid` AS `eprintid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> FROM `eprint`, `eprint_divisions` AS `eprint_divisions`, `subject_ancestors`
AS `243472156subject_ancestors` <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> WHERE `eprint`.`eprintid`=`eprint_divisions`.`eprintid` AND `eprint_divisions`.`divisions`=`243472156subject_ancestors`.`subjectid`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> AND `243472156subject_ancestors`.`ancestors` = 'd239')
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> AS `or_243378268`
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt"> WHERE `eprint`.`eprintid`=`or_243378268`.`eprintid`)
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt">AS `and_181190360_0` <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt">WHERE `eprint`.`eprintid`=`and_181190360_0`.`eprintid` AND `eprint`.`eprintid` = 41985
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt">GROUP BY `eprint`.`eprintid`<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Chris Keene - Technical Development Manager, University of Sussex Library
<br>
Contact: <a href="http://www.sussex.ac.uk/profiles/150000"><span style="color:blue">http://www.sussex.ac.uk/profiles/150000</span></a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>