Update statistics - Questions for guru's ?
Posted in 1997
Problem description.
We currently run update statistics during the night ( 11 PM - 7 AM ) on
the tables that have the biggest data distribution change through the
day. The update statistics is controlled from a unix script that deploys
each update statistics command one by one. Each table has it's
statistics updated in the following way...
Update statistics medium for table x resolution 1 0.99 distributionsonly
Update statistics high for table x (y) distributions only
Update statistics low for table x (z)
One thing that occurs consistently is applications that run during the
night can get -750 errors. I have documented below two cases that
occur...
########################################################################
#########
CASE ONE.
Code segment..
SET ISOLATION TO DIRTY READ
SET LOCK MODE TO WAIT 120
SELECT MAX(activ_gsm_id)
INTO v_activ_gsm_id
FROM activ_gsm
WHERE activ_gsm.actvn_id = work_rec.actvn_id
Update statistics command running..
Update statistics medium for table activ_gsm resolution 1 0.99distributions only.
Error statement report from application..
p_dirlist.4gl line 1033 3:08:39
SQL statement error number -750
Invalid distribution format found for actvn_id.
General logfile..
3:08:32 Update statistics statement started
3:08:39 -750 error reported by application.
error message "Invalid distribution format found for actvn_id."
########################################################################
##############
CASE TWO.
Code segment..
SET ISOLATION TO DIRTY READ
SET LOCK MODE TO WAIT 120
DECLARE frn_cur CURSOR FOR
SELECT
after_disc_amt,
cp_type,
prod_id,
eff_start_date,
eff_end_date,
tran_type_id
FROM invoice_item_fnd
WHERE cust_no = l_cust_no
AND after_disc_amt <> 0
AND transit_date = end_date
AND tran_type_id in (1,31,30)
AND ((cp_type <> 6
AND transit_date >= mdy(1,27,1994))
OR transit_date < mdy(1,27,1994))
ORDER BY tran_type_id
Update statistics command running..
Update statistics high for table invoice_item_fnd (transit_date)distributions only.
Error statement report from application..
p_bill_min.4gl line 562 6:18:15
SQL statement error number -750
Invalid distribution format found for transit_date.
General logfile..
6:18:15 Update statistics statement completed
6:18:15 -750 error reported by application.
error message "Invalid distribution format found for transit_date."
########################################################################
############
My question are as follows......
1) Why can I not run multiple update statistics statements at the same
time ?
2) Why would the two cases documented above be causing problems ?
3) We run update statistics for all stored procedures at the completion
of any update statistics scripts, Should we be running update statistics
for our procedures more often ? Should we have the stored procedure
update it's own statistics ?
########################################################################
#############
SITE INFORMATION.
HP-UX 10.20
INFORMIX 7.22.UC1X2
INFORMIX 6.05.UC1 tools
DB SIZE 50GB
########################################################################
#############
I look forward to any suggestions you can provide....
Cheers, Tony.
#include <standard disclaimers>