On Db2/Linux_x86 version we have several Db2 instances.

With iptraf-ng command sysadmin has noticed that one of this Db2 instance has 20-times more output network traffic then others which is unexpected.

There are no user complains of slow working applications and application developers testing production applications of "large network consuming database" and they can not determine any performance penalty for applications.

I have searched the most executed SQL-s from MON_GET_PKG_CACHE_STMT catalog table and few of them have been executed for few millions of times. The most executed SQL is executed 113 million times and this particular Db2 instance is up for 22 days. In average this is same 60 SQLs per second. This SQL and some of the top executed from the list have low volume of data returned, because where conditions produce no data or small amount of data.

We have to investigate why are those SQLs executed so many times, but why network consumption.

How to get list of top most SQLs that produces the most of network traffic? Or probably similar, how to get the list of SQLs that return the most data in bytes?


  • That kind of metadata (volume of result set) isn't generally recorded by most systems. It's been a long time since I worked with DB2, but could you instead trace a metric like total disk I/O for a SQL to give you an idea which may be generating the most data? Another approach would be to determine which client(s) are receiving all that network traffic, then determine what those clients are doing.
    – pmdba
    Commented Feb 14, 2023 at 12:29
  • I have searched for "bytes" in metrics, but can't find one. Also the most traffic is from one single Db2 client that is application server.
    – folow
    Commented Feb 14, 2023 at 13:30
  • Doesn't rows_returned from MON_GET_PKG_CACHE_STMT give you what you need?
    – mustaccio
    Commented Feb 14, 2023 at 14:11
  • rows_returned metric is for number of rows returned. I don't know if this is very good metric, because we have some tables with few columns and some tables with 300+ columns (this is purchased product). I would really need some bytes metric. Is there any?
    – folow
    Commented Feb 15, 2023 at 6:16
  • I haven't examined it very closely, but you can get some information on time spent on network via: table(mon_get_service_subclass_details(null,null,-2)) as t cross join table(mon_format_xml_times_by_row(t.details)) Probably not possible, but you can check if it is possible to relate that somehow to MON_GET_PKG_CACHE_STMT Commented Feb 17, 2023 at 7:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.