Stored procedure taking too long.
Posted in 1998
This is a multipart message in MIME format
--------------InterScan_NT_MIME_Boundary
Content-Type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: quoted-printable
Hi people,
=20
We have a stored procedure that takes 80 mins to complete=2E If we=20
extract the sql from this procedure, it takes about 1 second=2E The=20
procedure WAS using parameters, but I've replaced these temporarily=20
with hard-coded values, to remove this as a potential problem for the=20
optimizer=2E
=20
The statistics for both the procedure and the sql are identical, so=20
why does the procedure take this long?
=20
SQL is
=20
SELECT
pr_secoption=2Eseo_secid,
pr_secoption=2Eseo_deliverydate,
pr_secmast=2Esmctryissue
FROM
pr_secmast,pr_secoption
WHERE
(pr_secoption=2Eseo_secid =3D pr_secmast=2Esmsecid AND
pr_secoption=2Eseo_deliverydate !=3D '' AND
pr_secoption=2Eseo_deliverydate <=3D "1997-3-6 00:00:00=2E0=
00"=20
AND NOT EXISTS (
select casequence from pr_cmact, pr_cevent
where
pr_secoption=2Eseo_secid =3D pr_cevent=2Ece_smsecid and
pr_cevent=2Ece_exdivdate =3D pr_secoption=2Eseo_deliverydate a=nd
pr_cevent=2Ece_seq =3D pr_cmact=2Eca_ce_seq and
pr_cmact=2Ecaactioncode =3D "LAPSE"))
=20
Any pointers?
=20
TIA
Davin
**********************************************************************
DST International Tel:+44 181 390 5000 www=2Edstinternational=2Eco=2Eu=
k=20
This message and any attachments to it is intended only for the=20
individual or company to which it is addressed and may contain=20
information which is privileged, confidential or prohibited from=20
disclosure or unauthorised use=2E If the recipient of this=20
transmission is not the intended recipient, or the employee or agent=20
responsible for delivering such materials to the intended recipient,=20
you are hereby notified that any use, any form of reproduction,=20
dissemination, copying, disclosure, modification, distribution and/or=20
publication of this e-mail message or its attachments other than by=20
its intended recipient is strictly prohibited by the sender=2E =20
If you have received it in error, please notify us immediately by=20
telephone on the number above and destroy the message and all copies=20
in your possession=2E
**********************************************************************
--------------InterScan_NT_MIME_Boundary--