使用 onstat -u 命令来显示所有用户线程,并按会话标识显示内存使用率。
图: 未启用 SQL 语句高速缓存时的 onstat -u 输出
session #RSAM total used id user tty pid hostname threads memory memory 12 gbasedbt - 0 - 0 12288 7632 4 gbasedbt 11 5158 smoke 1 53248 45656 3 gbasedbt - 0 - 0 12288 8872 2 gbasedbt - 0 - 0 12288 7632
图: 启用 SQL 语句高速缓存时的 onstat -u 输出
session #RSAM total used id user tty pid hostname threads memory memory 17 gbasedbt - 0 - 0 12288 7632 16 gbasedbt 12 5258 smoke 1 40960 38784 4 gbasedbt 11 5158 smoke 1 53248 36920 3 gbasedbt - 0 - 0 12288 8872 2 gbasedbt - 0 - 0 12288 7632
图 2 也显示了分配给会话 16 使用的内存,该会话与会话 4 执行相同的 SQL 语句。 会话 16 分配的总内存 (40960 ) 和使用的内存 (38784 ) 均比会话 4 少(图 1 显示分别为 53248 和 45656 ),因为会话 16 使用了 SQL 语句高速缓存中现有的内存结构。