Posting from the Informix-list
Posted in 2001
Topics: Performance & Tuning, Server Administration
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C089F3.1F97E380
Content-Type: text/plain;
charset="iso-8859-1"
OS: SCO UNIX 5.0, IX: OWS 7.20.UC2
I have a table named payprmbcalc which also has index on its three fields.
This table contains 28000+ records. when I run a query on this table with
the db engine searches the table using sequential scan, where as I am
expecting search using an index. this query is taking too long to complete.
can you guys suggest any thing how to improve this query ...
The table schema and 'set explain on' output is attached here with.
The Table Schema ...
{ TABLE "paydba".payprmbcalc row size = 58 number of columns = 9 index size
= 36 }
create table "paydba".payprmbcalc
(
paymonth integer not null constraint "paydba".n196_305,
internalno char(6) not null constraint "paydba".n196_306,
currency char(10) not null constraint "paydba".n196_307,
balance decimal(10,2),
product decimal(10,2),
taxprofit decimal(10,2),
ntaxprofit decimal(10,2),
lastedit date,
lastuser char(10)
);
create unique index "paydba".pp001idx on "paydba".payprmbcalc
(paymonth,internalno, currency);
the 'set explain output' ...
QUERY:
------
select employee.employeeno , payprmbcalc.internalno,
employee.fname , employee.mname , employee.lname ,
payprmbcalc.currency , payprmbcalc.balance ,
employee.appointment , employee.termination ,
payprmbcalc.product , payprmbcalc.taxprofit ,
payprmbcalc.ntaxprofit
from payprmbcalc, employee
where payprmbcalc.paymonth = 2000130000
and employee.internalno = payprmbcalc.internalno
order by 1
Estimated Cost: 7
Estimated # of Rows Returned: 5
Temporary Files Required For: Order By
1) paydba.payprmbcalc: SEQUENTIAL SCAN { why ? i need index scan }
Filters: paydba.payprmbcalc.paymonth = 2000130000
2) paydba.employee: INDEX PATH
(1) Index Keys: internalno
Lower Index Filter: paydba.employee.internalno =
paydba.payprmbcalc.internalno
an early reply will be highly appreciated.
thanks.
Shahid Mehmood
Software Designer & IX DBA
Information Systems Department
The Aga Khan University,
Karachi
Official: Yes
------_=_NextPart_001_01C089F3.1F97E380
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2652.35">
<TITLE></TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2>OS: SCO UNIX 5.0, IX: OWS 7.20.UC2</FONT>
</P>
<P><FONT SIZE=3D2>I have a table named payprmbcalc which also has index =
on its three fields. This table contains 28000+ records. when I run a =
query on this table with the db engine searches the table using =
sequential scan, where as I am expecting search using an index. this =
query is taking too long to complete. can you guys suggest any thing =
how to improve this query ...</FONT></P>
<P><FONT SIZE=3D2>The table schema and 'set explain on' output is =
attached here with.</FONT>
</P>
<P><FONT SIZE=3D2>The Table Schema ...</FONT>
</P>
<P><FONT SIZE=3D2>{ TABLE "paydba".payprmbcalc row size =3D =
58 number of columns =3D 9 index size =3D 36 }</FONT>
<BR><FONT SIZE=3D2>create table "paydba".payprmbcalc</FONT>
<BR><FONT SIZE=3D2> (</FONT>
<BR><FONT SIZE=3D2> paymonth integer not null =
constraint "paydba".n196_305,</FONT>
<BR><FONT SIZE=3D2> internalno char(6) not null =
constraint "paydba".n196_306,</FONT>
<BR><FONT SIZE=3D2> currency char(10) not null =
constraint "paydba".n196_307,</FONT>
<BR><FONT SIZE=3D2> balance decimal(10,2),</FONT>
<BR><FONT SIZE=3D2> product decimal(10,2),</FONT>
<BR><FONT SIZE=3D2> taxprofit decimal(10,2),</FONT>
<BR><FONT SIZE=3D2> ntaxprofit decimal(10,2),</FONT>
<BR><FONT SIZE=3D2> lastedit date,</FONT>
<BR><FONT SIZE=3D2> lastuser char(10)</FONT>
<BR><FONT SIZE=3D2> );</FONT>
</P>
<P><FONT SIZE=3D2>create unique index "paydba".pp001idx on =
"paydba".payprmbcalc (paymonth,internalno, currency);</FONT>
</P>
<P><FONT SIZE=3D2>the 'set explain output' ...</FONT>
</P>
<P><FONT SIZE=3D2>QUERY:</FONT>
<BR><FONT SIZE=3D2>------</FONT>
<BR><FONT SIZE=3D2>select employee.employeeno , =
payprmbcalc.internalno,</FONT>
<BR><FONT SIZE=3D2> employee.fname =
, employee.mname , employee.lname ,</FONT>
<BR><FONT SIZE=3D2> =
payprmbcalc.currency , payprmbcalc.balance ,</FONT>
<BR><FONT SIZE=3D2> =
employee.appointment , employee.termination ,</FONT>
<BR><FONT SIZE=3D2> =
payprmbcalc.product , payprmbcalc.taxprofit ,</FONT>
<BR><FONT SIZE=3D2> =
payprmbcalc.ntaxprofit</FONT>
<BR><FONT SIZE=3D2> from payprmbcalc, employee</FONT>
<BR><FONT SIZE=3D2> where payprmbcalc.paymonth =3D =
2000130000</FONT>
<BR><FONT SIZE=3D2> and employee.internalno =3D =
payprmbcalc.internalno</FONT>
<BR><FONT SIZE=3D2> order by 1</FONT>
</P>
<P><FONT SIZE=3D2>Estimated Cost: 7</FONT>
<BR><FONT SIZE=3D2>Estimated # of Rows Returned: 5</FONT>
<BR><FONT SIZE=3D2>Temporary Files Required For: Order By</FONT>
</P>
<P><FONT SIZE=3D2>1) paydba.payprmbcalc: SEQUENTIAL SCAN =
{ why ? i need index scan =
}</FONT>
</P>
<P><FONT SIZE=3D2> Filters: =
paydba.payprmbcalc.paymonth =3D 2000130000</FONT>
</P>
<P><FONT SIZE=3D2>2) paydba.employee: INDEX PATH</FONT>
</P>
<P><FONT SIZE=3D2> (1) Index Keys: internalno</FONT>
<BR><FONT SIZE=3D2> Lower =
Index Filter: paydba.employee.internalno =3D =
paydba.payprmbcalc.internalno</FONT>
</P>
<P><FONT SIZE=3D2>an early reply will be highly appreciated.</FONT>
</P>
<P><FONT SIZE=3D2>thanks.</FONT>
</P>
<P><FONT SIZE=3D2>Shahid Mehmood</FONT>
<BR><FONT SIZE=3D2>Software Designer & IX DBA</FONT>
<BR><FONT SIZE=3D2>Information Systems Department</FONT>
<BR><FONT SIZE=3D2>The Aga Khan University,</FONT>
<BR><FONT SIZE=3D2>Karachi</FONT>
</P>
<P><FONT SIZE=3D2>Official: Yes</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C089F3.1F97E380--
Have you run update statistics recently?
In article <953qg7$9r7$1@news.xmission.com>,
"shahid.mehmood" <shahid.mehmood@aku.edu> wrote:
>
> This message is in MIME format. Since your mail reader does not
understand
> this format, some or all of this message may not be legible.
>
> ------_=_NextPart_001_01C089F3.1F97E380
> Content-Type: text/plain;
> charset="iso-8859-1"
>
> OS: SCO UNIX 5.0, IX: OWS 7.20.UC2
>
> I have a table named payprmbcalc which also has index on its three
fields.
> This table contains 28000+ records. when I run a query on this table
with
> the db engine searches the table using sequential scan, where as I am
> expecting search using an index. this query is taking too long to
complete.
> can you guys suggest any thing how to improve this query ...
>
> The table schema and 'set explain on' output is attached here with.
>
> The Table Schema ...
>
> { TABLE "paydba".payprmbcalc row size = 58 number of columns = 9
index size
> = 36 }
> create table "paydba".payprmbcalc
> (
> paymonth integer not null constraint "paydba".n196_305,
> internalno char(6) not null constraint "paydba".n196_306,
> currency char(10) not null constraint "paydba".n196_307,
> balance decimal(10,2),
> product decimal(10,2),
> taxprofit decimal(10,2),
> ntaxprofit decimal(10,2),
> lastedit date,
> lastuser char(10)
> );
>
> create unique index "paydba".pp001idx on "paydba".payprmbcalc
> (paymonth,internalno, currency);
>
> the 'set explain output' ...
>
> QUERY:
> ------
> select employee.employeeno , payprmbcalc.internalno,
> employee.fname , employee.mname , employee.lname ,
> payprmbcalc.currency , payprmbcalc.balance ,
> employee.appointment , employee.termination ,
> payprmbcalc.product , payprmbcalc.taxprofit ,
> payprmbcalc.ntaxprofit
> from payprmbcalc, employee
> where payprmbcalc.paymonth = 2000130000
> and employee.internalno = payprmbcalc.internalno
> order by 1>
> Estimated Cost: 7
> Estimated # of Rows Returned: 5
> Temporary Files Required For: Order By
>
> 1) paydba.payprmbcalc: SEQUENTIAL SCAN { why ? i need
index scan }
>
> Filters: paydba.payprmbcalc.paymonth = 2000130000
>
> 2) paydba.employee: INDEX PATH
>
> (1) Index Keys: internalno
> Lower Index Filter: paydba.employee.internalno =
> paydba.payprmbcalc.internalno
>
> an early reply will be highly appreciated.
>
> thanks.
>
> Shahid Mehmood
> Software Designer & IX DBA
> Information Systems Department
> The Aga Khan University,
> Karachi
>
> Official: Yes
>
> ------_=_NextPart_001_01C089F3.1F97E380
> Content-Type: text/html;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
> <HTML>
> <HEAD>
> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
> charset=3Diso-8859-1">
> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
> 5.5.2652.35">
> <TITLE></TITLE>
> </HEAD>
> <BODY>
>
> <P><FONT SIZE=3D2>OS: SCO UNIX 5.0, IX: OWS 7.20.UC2</FONT>
> </P>
>
> <P><FONT SIZE=3D2>I have a table named payprmbcalc which also has
index =
> on its three fields. This table contains 28000+ records. when I run a
=
> query on this table with the db engine searches the table using =
> sequential scan, where as I am expecting search using an index. this =
> query is taking too long to complete. can you guys suggest any thing =
> how to improve this query ...</FONT></P>
>
> <P><FONT SIZE=3D2>The table schema and 'set explain on' output is =
> attached here with.</FONT>
> </P>
>
> <P><FONT SIZE=3D2>The Table Schema ...</FONT>
> </P>
>
> <P><FONT SIZE=3D2>{ TABLE "paydba".payprmbcalc row size =3D
=
> 58 number of columns =3D 9 index size =3D 36 }</FONT>
> <BR><FONT SIZE=3D2>create table "paydba".payprmbcalc</FONT>
> <BR><FONT SIZE=3D2> (</FONT>
> <BR><FONT SIZE=3D2> paymonth integer not null =
> constraint "paydba".n196_305,</FONT>
> <BR><FONT SIZE=3D2> internalno char(6) not null =
> constraint "paydba".n196_306,</FONT>
> <BR><FONT SIZE=3D2> currency char(10) not null =
> constraint "paydba".n196_307,</FONT>
> <BR><FONT SIZE=3D2> balance decimal(10,2),</FONT>
> <BR><FONT SIZE=3D2> product decimal(10,2),</FONT>
> <BR><FONT SIZE=3D2> taxprofit decimal(10,2),</FONT>
> <BR><FONT SIZE=3D2> ntaxprofit decimal(10,2),</FONT>
> <BR><FONT SIZE=3D2> lastedit date,</FONT>
> <BR><FONT SIZE=3D2> lastuser char(10)</FONT>
> <BR><FONT SIZE=3D2> );</FONT>
> </P>
>
> <P><FONT SIZE=3D2>create unique index "paydba".pp001idx on =
> "paydba".payprmbcalc (paymonth,internalno, currency);</FONT>
> </P>
>
> <P><FONT SIZE=3D2>the 'set explain output' ...</FONT>
> </P>
>
> <P><FONT SIZE=3D2>QUERY:</FONT>
> <BR><FONT SIZE=3D2>------</FONT>
> <BR><FONT SIZE=3D2>select employee.employeeno , =
> payprmbcalc.internalno,</FONT>
> <BR><FONT SIZE=3D2>
employee.fname =
> , employee.mname , employee.lname ,</FONT>
> <BR><FONT SIZE=3D2> =
> payprmbcalc.currency , payprmbcalc.balance ,</FONT>
> <BR><FONT SIZE=3D2> =
> employee.appointment , employee.termination ,</FONT>
> <BR><FONT SIZE=3D2> =
> payprmbcalc.product , payprmbcalc.taxprofit ,</FONT>
> <BR><FONT SIZE=3D2> =
> payprmbcalc.ntaxprofit</FONT>
> <BR><FONT SIZE=3D2> from payprmbcalc, employee</FONT>
> <BR><FONT SIZE=3D2> where payprmbcalc.paymonth =3D =
> 2000130000</FONT>
> <BR><FONT SIZE=3D2> and employee.internalno =3D =
> payprmbcalc.internalno</FONT>
> <BR><FONT SIZE=3D2> order by 1</FONT>
> </P>
>
> <P><FONT SIZE=3D2>Estimated Cost: 7</FONT>
> <BR><FONT SIZE=3D2>Estimated # of Rows Returned: 5</FONT>
> <BR><FONT SIZE=3D2>Temporary Files Required For: Order By</FONT>
> </P>
>
> <P><FONT SIZE=3D2>1) paydba.payprmbcalc: SEQUENTIAL SCAN =
> { why ? i need index scan =
> }</FONT>
> </P>
>
> <P><FONT SIZE=3D2> Filters: =
> paydba.payprmbcalc.paymonth =3D 2000130000</FONT>
> </P>
>
> <P><FONT SIZE=3D2>2) paydba.employee: INDEX PATH</FONT>
> </P>
>
> <P><FONT SIZE=3D2> (1) Index Keys: internalno</FONT>
> <BR><FONT SIZE=3D2> Lower =
> Index Filter: paydba.employee.internalno =3D =
> paydba.payprmbcalc.internalno</FONT>
> </P>
>
> <P><FONT SIZE=3D2>an early reply will be highly appreciated.</FONT>
> </P>
>
>