Request for tunning the below query

Posted on 16th Feb 2014 by admin

Hi,

Can any one help me on the below query while improving the performance,

SELECT accdet, acceprec, accinvalid, accnetanal, accphy, accvalid,
actlabcost, actlabhrs, actualcontactdate, actualfinish, actualstart,
affecteddate, affectedemail, affectedperson, affectedphone,
alteration, aslaiddwg, assetnum, assetorgid, assetsiteid,
assumptions, basedet, basereq, bicounty, bidplo, bieasting,
bihousename, bihouseno, binorthing, bipobox, bipostcode, biposttown,
bistreet, bisubb as bisupp, boostcomp, boostcompdet, ccemail, cchouseno, ccid,
ccname, cctel1type, cctel2type, cctelephone1, cctelephone2, cdm,
changeby, changedate, CLASS, classstructureid, cocontact, cocounty,
codplo, coeasment, coeasting, cohousename, conorthing, copobox,
commodity, commoditygroup, coneasereq, consent, consents,
copostcode, coposttown, costcon, costreet, cosubb, cpi90,
createworelasset, customerref, custtype, depot, description, durt,
ecvpressuretier, ecvsize, enduserid, engdifficult, exaoq, existin,
existsdq, expid, exshq, externalrecid, extralanddetail, failurecode,
fr1code, fr2code, fuelpovscheme, g17, gbna, glaccount,
globalticketclass, globalticketid, govconf, govener, govenerdet,
govhouse, hasactivity, hasld, historyflag, impact, infill,
infoprovide, inheritstatus, internalpriority, interquote, isglobal,
isknownerror, isknownerrordate, kioskdet, kioskreq, langcode,
latecertdate, leadt, lengthpri, lengthpub, loadtype, LOCATION, m25,
maindesac, mainusage, meterboxty, metercon, meterloc, meterser,
mininforec, mininforeq, mprnno, newaoq, newpid, newsdq, newshq,
np14, nrswa, nsgno, oldquotever, oldticketid, orgid, originsgn,
origrecordclass, origrecordid, origrecorgid, origrecsiteid, owner,
ownergroup, packagesent, paymethod, payterms, permittowork, physub,
pressuretier, privateexc, problemcode, propertiesno, propertytype,
publicexc, purgerel, quotedate, quotetype, quotever, reinforcement,
reinforcementa, reinforcementb, relatedtoglobal, reportdate,
reportedby, reportedemail, reportedphone, reportedpriority,
rowstamp, sc, scj, scoreq, servicerelay, sgnbillcontact,
sgnblkbyfin, sgncusttobill, sgncusttosite, sgndisreasoth,
sgneasment, sgnenhance, sgneow, sgneowreq, sgngqmvalid,
sgninfillcost, sgninfillver, sgninfprojno, sgnisstdchrg,
sgnloadnoenter, sgnmainsreq, sgnmaxaccdate, sgnnoncont, sgnpipesiz,
sgnpurord, sgnqdaysremain, sgnqstd, sgnquotdate, sgnquotval,
sgnreasdis, sgntotalaoq, sgntotalshq, sgnvarreq, sicontact,
sicounty, sidplo, sieasting, sihousename, sihouseno, sinorthing,
sipobox, sipostcode, siposttown, sistreet, sisubb, sitecond, sitegt,
siteid, sitel1, sitel2, siteplpro, sitevisit, solution, sos,
sosrecdate, SOURCE, status, statusdate, subfinal, supervisor,
supplytype, surveycarr, surveydef, surveyreas, surveyreq, surveyret,
surveysent, targetcontactdate, targetfinish, targetstart, TEMPLATE,
templateid, termtype, thirdpartyeas, thirdpartypipe, ticketid,
ticketuid, totalaoq, totalpid, totalsdq, totalshq, traffictime,
typewo, urgency, variat, vendor, customer_enquiry_ref,
quote_version, costs, mains_infill_charge, mtr_housing_kiosk_charge,
mtr_housing_kiosk_base_charge, specialist_reinstatement,
easement_charge, total_quote_ex_vat, vat, total_quote_incl_vat,
design_charge, reinforcement_charge, reinforcement_cost,
connection_allowance, workorder.pscdate, workorder.ascdate,
workorder.fincode, workorder.istask, workorder.status,
workorder.targstartdate, workorder.targcompdate,
workorder.schedfinish, workorder.actfinish, workorder.estdur,
workorder.wonum, workorder.mprn,
workorder.sihousename AS wositehousename,
workorder.sihouseno AS wositehouseno,
workorder.sistreet AS wositestreet,
workorder.sicounty AS wositecounty,
workorder.siposttown AS wositeposttown,
workorder.sipostcode AS wositepostcode, workorder.workorderid
FROM (maximo.sr
INNER JOIN
(maximo.relatedrecord INNER JOIN maximo.workorder
ON relatedrecord.relatedreckey =
(CASE
WHEN workorder.PARENT IS NOT NULL
THEN workorder.PARENT
ELSE workorder.wonum
END
)
AND relatedrecord.orgid = workorder.orgid
AND relatedrecord.siteid = workorder.siteid
AND relatedrecord.relatedrecclass = 'WORKORDER')
ON sr.ticketid = relatedrecord.recordkey
AND sr.orgid = relatedrecord.orgid
AND sr.siteid = relatedrecord.siteid
AND relatedrecord.CLASS = 'SR')
LEFT JOIN
frozen_quote@gqmfof
ON sr.ticketid = customer_enquiry_ref
AND sr.quotever = quote_version
Regards,

Other forums