Have you wondered what SQL is being executed against your database and its frequency? DB2 stores that information for all dynamic SQL. A DBA can look at all the dynamic SQL running against their database and decide if the tables are laid out in the correct tablespaces and on the disk (to help with I/O). It also works well with other tips about the DB2 explains and the index advisor to optimize your database to run the best it can. It has been tested on DB2 UDB v7.
To get the info:
db2 reset monitor for database <database-alias> db2 get snapshot for dynamic sql on <database-alias> > to_an_outputfile
For More Information
- Feedback: E-mail the editor with your thoughts about this tip.
- More tips: Hundreds of free DB2 tips and scripts.
- Tip contest: Have a DB2 tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize -- submit your tip today!
- Ask the Experts: Our SQL, database design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.
- Forums: Ask your technical DB2 questions--or help out your peers by answering them--in our active forums.
- Best Web Links: DB2 tips, tutorials, and scripts from around the Web.