Entries are getting very slow. [message #289977] |
Thu, 27 December 2007 00:10 |
ksaravin
Messages: 2 Registered: December 2007 Location: India
|
Junior Member |
|
|
Dear All,
My users are complaining that their entries are getting very slow. Here with I have attached one day transaction details captured through statspack. Any one can suggest how to fine tune and improve the performance highly appreciated.
Saravanan.K
|
|
|
Re: Entries are getting very slow. [message #290002 is a reply to message #289977] |
Thu, 27 December 2007 01:35 |
|
Michel Cadot
Messages: 68731 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
If you want a statspack report to be uselful you have to first set timed_statistics to true.
Then you have to take a snapshot every 1/2 hour, a snapshot on 1 day is useless.
Nevertheless you have the heaviest queries, investigate on them.
But you have to know that you must first optimize the application before trying to optimize the queries and finally the database.
Regards
Michel
[Updated on: Thu, 27 December 2007 01:37] Report message to a moderator
|
|
|
Re: Entries are getting very slow. [message #290093 is a reply to message #289977] |
Thu, 27 December 2007 06:40 |
michael_bialik
Messages: 621 Registered: July 2006
|
Senior Member |
|
|
Just for starter:
SELECT SUM(QTYACCT) WT,SUM(LANDCOST)
FROM STORES.PLANTRECEIPTS
WHERE ITEMCODE = :b1 AND
COMPCODE || UNITCODE || PLANT || ITEMCODE ||
RECDOC || BATCHNO = :b2 || :b3 || :b1 || :b5 || :b6
GROUP BY COMPCODE,UNITCODE,PLANT,ITEMCODE,RECDOC,BATCHNO
1. IMHO there is a BUG:
Suppose you have 2 sets of values:
COMPCODE || UNITCODE || PLANT || ITEMCODE ||
RECDOC || BATCHNO = '1111' || '111' || ...
and
COMPCODE || UNITCODE || PLANT || ITEMCODE ||
RECDOC || BATCHNO = '111' || '1111' || ...
in both cases you will get the same answer.
I recommend to split the WHERE ( anyway the number of parameters does not correspond to the number of concatenated columns) and to rewrite the statement as:
SELECT SUM(QTYACCT) WT,SUM(LANDCOST)
FROM STORES.PLANTRECEIPTS
WHERE ITEMCODE = :b1 AND
COMPCODE = :p1 AND UNITCODE = :p2 AND PLANT = :p3 AND ITEMCODE = :b1 AND RECDOC = :b5 AND BATCHNO = :b6
GROUP BY COMPCODE,UNITCODE,PLANT,ITEMCODE,RECDOC,BATCHNO
The statement performs too much IO, so try and define an index(after rewriting the statement):
CREATE INDEX ... ON STORES.PLANTRECEIPTS (
ITEMCODE, COMPCODE, UNITCODE, PLANT, RECDOC, BATCHNO ) ...
Michael
|
|
|
|
|
|