If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 Performance Problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-20-05, 21:29
bson bson is offline
Registered User
 
Join Date: Feb 2005
Posts: 9
DB2 Performance Problem

Hi all,

Our DB2 7.2 server is running on Windows 2000 and the server was setup by someone 4 years ago, who is not working here anymore. Few weeks ago, we changed our DB2 server's hardware from Intel PIII 800MHz with 1G RAM to Xeon 2.8MHz with two CPUs and 1.5G RAM. The database's data is moved to the new server by restoring through an offline backup.

The new server is running okay but when it runs a query, which uses UNION ALL keyword, it takes over an hour to finish and I found that the CPU Usage in Task Manager is around 100%. However, in our old DB2 server, it takes only 3 seconds.

I have checked the DB2 database and database manager configuration but I could not find any differences in their settings.

Any ideas would be deeply appreciated.

Thank you!


Bson
Reply With Quote
  #2 (permalink)  
Old 02-20-05, 21:59
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
The first thing I would try is to execute the runstats command on all tables and indexes with distribution on key columns. See the Command Reference for details. If you have any static SQL, you will need to rebind the packages.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 02-20-05, 22:23
bson bson is offline
Registered User
 
Join Date: Feb 2005
Posts: 9
Hi Marcus,

I did ran the commands for all of our tables as the sample below

db2 reorg table table_a
db2 runstats on table table_a with distribution and indexes all

Bson
Reply With Quote
  #4 (permalink)  
Old 02-20-05, 22:42
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Do you know how to run a visual explain on the SQL statement. That would tell you what access path is being used. If you post the explain output, the table(s) DDL, and the SQL query, someone might be able to help.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #5 (permalink)  
Old 02-20-05, 23:35
tkwlaw tkwlaw is offline
Registered User
 
Join Date: Feb 2005
Posts: 3
Have you compared the configuration of your new and old DBs by issuing the db2 get dbm cfg command?

Improper parameters setting can lead to performance issue.
Reply With Quote
  #6 (permalink)  
Old 02-21-05, 01:23
bson bson is offline
Registered User
 
Join Date: Feb 2005
Posts: 9
Hi tkwlaw,

I had already check both the dbm cfg and db cfg and I could not find any difference.

But one thing I did not metion is that our old db2 7.2 server was using Enterprise Edition but in my new db2 server, we are using Workgroup Edition.

Thank all of you!

Bson
Reply With Quote
  #7 (permalink)  
Old 02-21-05, 01:26
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
What is the fixpak number?
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #8 (permalink)  
Old 02-21-05, 04:25
bson bson is offline
Registered User
 
Join Date: Feb 2005
Posts: 9
it is v7.1.0.98 - WR21337
Reply With Quote
  #9 (permalink)  
Old 02-21-05, 21:28
bson bson is offline
Registered User
 
Join Date: Feb 2005
Posts: 9
I found the problem! The script, which I used for reorg and runstats does not work. Then I used runstats function in DB2 Control Center, the problem solves!

Does anyone know why the commands below causing the problem?

-- runstats command causing the problem
db2 reorg table table_a
db2 runstats on table table_a with distribution and indexes all


-- db2 generated runstats command solving the problem
RUNSTATS ON TABLE DBA.HDR SHRLEVEL CHANGE

Thank a lots guys!

Bson
Reply With Quote
  #10 (permalink)  
Old 02-21-05, 23:28
chavadb2 chavadb2 is offline
Registered User
 
Join Date: Aug 2004
Posts: 138
did you set the correct schema in the script? may be that's the reason
Reply With Quote
  #11 (permalink)  
Old 02-21-05, 23:34
bson bson is offline
Registered User
 
Join Date: Feb 2005
Posts: 9
Yes, I had set the schema running the commands. and after running the commands, it said "command run successfully".
Reply With Quote
  #12 (permalink)  
Old 02-22-05, 01:37
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
The Command Reference manual says regarding the runstats command:

"The fully qualified name or alias in the form: schema.table-name must be used."

The set schema command is for SQL statements, not for DB2 commands like runstats.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #13 (permalink)  
Old 02-22-05, 01:52
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
bson,

If you copied the script from old computer to new one without any changes,there can be a conclusion the script has never been working, so runstats on old computer was never done with this script.

Hope this helps,
Grofaty
Reply With Quote
  #14 (permalink)  
Old 02-22-05, 02:08
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
When doing a REORG on DB2 version 7 you should specify the index name or it does not really re-order the table rows (the reorg finishes very quickly). If you have more than one index, chose the index that you want to reorder the rows with (this is a another discussion).

REORG TABLE table-name INDEX index-name
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #15 (permalink)  
Old 02-22-05, 03:42
bson bson is offline
Registered User
 
Join Date: Feb 2005
Posts: 9
Thanks Marcus_A, could you give me some samplel when running the runstats command and a table is more than one index ?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On