Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Query tuning
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 3466 of 3799
Post > Topic >>

Query tuning

by kapil.munish@[EMAIL PROTECTED] May 15, 2008 at 11:30 AM

This is a multi-part message in MIME format.

------_=_NextPart_001_01C8B650.F34C5E2C
Content-Type: text/plain;
	charset="us-ascii"
content-transfer-encoding: quoted-printable

Hi,

 

 

I have a query which is run across 3 tables JOB_TYPE_FIRST,
JOB_TYPE_SECOND and JOB_ALLOCATION_WORKLIST.

 

The column JOBID is referenced in JOB_ALLOCATION_WORKLIST table and
primary key in both JOB_TYPE_FIRST, JOB_TYPE_SECOND tables.

 

There is one more column BOOK_ID which is supplied as the binding
parameter to the query. The query looks like:

 

select count(distinct(j.JOBID)) as jobCount 

from  JOB_TYPE_FIRST a, JOB_TYPE_SECOND b, JOB_ALLOCATION_WORKLIST j 

where (( a.JOBID =3D j.JOBID) 

and (a.BOOK_ID =3D :bookId)) 

or ((b.JOBID =3D j.JOBID) 

and (b.BOOK_ID =3D :bookId));

 

As the records in the database are too large it is having huge cost and
stalling the server and takes lot of time. 

 

Can anyone suggest a better way to fetch the results for the query or
tune it? Any help would be highly appreciated.

 

 

Thanks & Regards,

Kapil


Please do not print this email unless it is absolutely necessary. =0A=
=0A=
The information contained in this electronic message and any attachments
to=
 this message are intended for the exclusive use of the addressee(s) and
may=
 contain proprietary, confidential or privileged information. If you are
not=
 the intended recipient, you should not disseminate, distribute or copy
this=
 e-mail. Please notify the sender immediately and destroy all copies of
this=
 message and any attachments. =0A=
=0A=
WARNING: Computer viruses can be transmitted via email. The recipient
should=
 check this email and any attachments for the presence of viruses. The
compa=
ny accepts no liability for any damage caused by any virus transmitted by
th=
is email. =0A=
=0A=
www.wipro.com

------_=_NextPart_001_01C8B650.F34C5E2C
Content-Type: text/html;
	charset="us-ascii"
content-transfer-encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office"
xmlns:w=3D"urn:sch=
emas-microsoft-com:office:word" xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @[EMAIL PROTECTED]
"Comic Sans MS";
	panose-1:3 15 7 2 3 3 2 2 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@[EMAIL PROTECTED]
 Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>Hi,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>I have a query which is run across 3
tab=
les
JOB_TYPE_FIRST, JOB_TYPE_SECOND and
JOB_ALLOCATION_WORKLIST.<o:p></o:p></spa=
n></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>The column JOBID is referenced in
JOB_AL=
LOCATION_WORKLIST
table and primary key in both JOB_TYPE_FIRST, JOB_TYPE_SECOND
tables.<o:p></=
o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>There is one more column BOOK_ID which
i=
s
supplied as the binding parameter to the query. The query looks
like:<o:p></=
o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>select count(distinct(j.JOBID)) as
jobCo=
unt
<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>from&nbsp; JOB_TYPE_FIRST a,
JOB_TYPE_SECOND b, JOB_ALLOCATION_WORKLIST j <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>where (( a.JOBID =3D j.JOBID)
<o:p></o:p=
></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>and (a.BOOK_ID =3D :bookId))
<o:p></o:p>=
</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>or ((b.JOBID =3D j.JOBID)
<o:p></o:p></s=
pan></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>and (b.BOOK_ID =3D
:bookId));<o:p></o:p>=
</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>As the records in the database are too
large it is having huge cost and stalling the server and takes lot of
time.=
 <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>Can anyone suggest a better way to
fetch
the results for the query or tune it? Any help would be highly
appreciated.<=
o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>Thanks &amp;
Regards,<o:p></o:p></span><=
/font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Comic Sans MS"><span
style=3D'fo=
nt-size:
10.0pt;font-family:"Comic Sans MS"'>Kapil<o:p></o:p></span></font></p>

</div>

<P><strong><span style=3D'font-size:10.0pt;font-family:=0A=
"Palatino Linotype","serif";color:green'> Please do not print this email
unl=
ess it is absolutely necessary. </span></strong><span
style=3D'font-family:"=
Arial","sans-serif"'><o:p></o:p></span></p>=0A=
=0A=
=0A=
<p> The information contained in this electronic message and any
attachments=
 to this message are intended for the exclusive use of the addressee(s)
and=
 may contain proprietary, confidential or privileged information. If you
are=
 not the intended recipient, you should not disseminate, distribute or
copy=
 this e-mail. Please notify the sender immediately and destroy all copies
of=
 this message and any attachments. </p>=0A=
=0A=
<p>WARNING: Computer viruses can be transmitted via email. The recipient
sho=
uld check this email and any attachments for the presence of viruses. The
co=
mpany accepts no liability for any damage caused by any virus transmitted
by=
 this email. </p>=0A=
<p>=0A=
www.wipro.com=0A=
</p>
</body>

</html>

------_=_NextPart_001_01C8B650.F34C5E2C--
 




 3 Posts in Topic:
Query tuning
kapil.munish@[EMAIL PROTE  2008-05-15 11:30:17 
Re: Query tuning
moizpostgres@[EMAIL PROTE  2008-05-16 17:20:21 
Re: Query tuning
simon@[EMAIL PROTECTED]   2008-05-16 17:13:09 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 21:51:28 CST 2008.