indexing strategies
Posted in 2000
You could run the following query which will pull out the high cost sqls
running on your server. Then start messing around with indexes and SET
EXPLAIN in dbaccess to see if you can optimize your queries.
database sysmaster;
select s.username,
s.pid unix_pid,
s.hostname,
s.tty,
q.sqx_estcost,
q.sqx_estrows,
q.sqx_sqlstatement
from syssessions s,
syssqexplain q
where s.sid = q.sqx_sessionid
and q.sqx_estcost > 500
order by q.sqx_estcost desc;
OUTPUT:
username jsmith
unix_pid 21506
hostname florida1
tty /dev/pts/3
sqx_estcost 1525
sqx_estrows 8
sqx_sqlstatement
select * from customer, orders
where customer.customer_num = orders.customer_num
and ship_date > "01/01/1976"
Note on the output: This is only one of several rows that will be returned.
They will be in order from highest to lowest estimated cost.
_____________________________________________________________________________________
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com