AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题 / 230640
Accepted
Learning_DBAdmin
Learning_DBAdmin
Asked: 2019-02-26 00:58:36 +0800 CST2019-02-26 00:58:36 +0800 CST 2019-02-26 00:58:36 +0800 CST

查找 APL 堆表插入的来源和详细信息

  • 772

我一直在使用以下命令在 HP-UX(Itanium)上的 Sybase ASE 15.7(SP139)上运行系统监视器(sysmon):

sp_sysmon "00:10:00"
go

观察到插入次数在一天中的任何时间都非常高,无法找到它的来源和详细信息,例如表名、数据库名、程序名等。下面是清晨 sysmon 的示例输出,当时有空载:

Transaction Profile
-------------------

  Transaction Summary             per sec      per xact       count  % of total
  -------------------------  ------------  ------------  ----------  ---------- 
    Committed Xacts                  10.7           n/a        6390     n/a     

  Transaction Detail              per sec      per xact       count  % of total
  -------------------------  ------------  ------------  ----------  ---------- 
  Inserts
    Fully Logged
      APL Heap Table              58665.7        5508.5    35199448     100.0 %
      APL Clustered Table             0.0           0.0           7       0.0 %
      Data Only Lock Table           13.2           1.2        7918       0.0 %
      Fast Bulk Insert                0.0           0.0           0       0.0 %
      Fast Log Bulk Insert            0.0           0.0           0       0.0 %
    Minimally Logged
      APL Heap Table                  0.0           0.0           0       0.0 %
      APL Clustered Table             0.0           0.0           0       0.0 %
      Data Only Lock Table            0.0           0.0           0       0.0 %
  -------------------------  ------------  ------------  ----------  ---------- 
  Total Rows Inserted             58679.0        5509.8    35207373     100.0 %

看起来 tempdb 中正在发生插入,但是这么多插入有点麻烦,感谢专家的建议。

sybase monitoring
  • 1 1 个回答
  • 43 Views

1 个回答

  • Voted
  1. Best Answer
    Learning_DBAdmin
    2019-03-18T23:15:56+08:002019-03-18T23:15:56+08:00

    我找到了一种间接的方法来解决我的问题中发布的问题,因为我找不到任何可以监视数据库级别发生的所有插入的工具或脚本,我分析了每天 24 小时运行并正在使用的过程(查询)生产数据库的最大资源。为了模拟,我在测试环境中手动执行了该过程及其所有参数,并使 sysmon 在后台运行的时间与执行过程所需的时间相同。我设法在测试环境中收集了接近相同数量的插入。

    为了证明这是唯一每秒钟执行如此多插入次数的程序,我还在有问题的程序之前和之后运行 sysmon 并捕获了插入次数,它是数百而不是数千。

    Sysmon 在过程执行期间:

    Transaction Profile
    -------------------
    
      Transaction Summary             per sec      per xact       count  % of total
      -------------------------  ------------  ------------  ----------  ---------- 
        Committed Xacts                   0.1           n/a           9     n/a     
    
      Transaction Detail              per sec      per xact       count  % of total
      -------------------------  ------------  ------------  ----------  ---------- 
      Inserts
        Fully Logged
          APL Heap Table              89575.5      895754.9     8061794     100.0 %
          APL Clustered Table             0.0           0.0           0       0.0 %
          Data Only Lock Table            0.0           0.0           0       0.0 %
          Fast Bulk Insert                0.0           0.0           0       0.0 %
          Fast Log Bulk Insert            0.0           0.0           0       0.0 %
        Minimally Logged
          APL Heap Table                  0.0           0.0           0       0.0 %
          APL Clustered Table             0.0           0.0           0       0.0 %
          Data Only Lock Table            0.0           0.0           0       0.0 %
      -------------------------  ------------  ------------  ----------  ---------- 
      Total Rows Inserted             89575.5      895754.9     8061794     100.0 %
    

    Sysmon 程序执行前/后(未运行时):

    Transaction Profile
    -------------------
    
      Transaction Summary             per sec      per xact       count  % of total
      -------------------------  ------------  ------------  ----------  ---------- 
        Committed Xacts                   0.1           n/a          13     n/a     
    
      Transaction Detail              per sec      per xact       count  % of total
      -------------------------  ------------  ------------  ----------  ---------- 
      Inserts
        Fully Logged
          APL Heap Table                127.6         883.7       11488     100.0 %
          APL Clustered Table             0.0           0.0           0       0.0 %
          Data Only Lock Table            0.0           0.0           0       0.0 %
          Fast Bulk Insert                0.0           0.0           0       0.0 %
          Fast Log Bulk Insert            0.0           0.0           0       0.0 %
        Minimally Logged
          APL Heap Table                  0.0           0.0           0       0.0 %
          APL Clustered Table             0.0           0.0           0       0.0 %
          Data Only Lock Table            0.0           0.0           0       0.0 %
      -------------------------  ------------  ------------  ----------  ---------- 
      Total Rows Inserted               127.6         883.7       11488     100.0 %
    

    这样,我设法找到了每秒执行 60k 插入的过程。另外要补充的是,这些插入是因为表的不正确连接(包含大量记录)和插入数量以工作表的形式出现,如下所示:

    Table: Worktable1 scan count 1, logical reads: (regular=88517 apf=0 total=88517), physical reads: (regular=52316 apf=0 total=52316), apf IOs used=0
    Table: Worktable1 scan count 0, logical reads: (regular=8092124 apf=0 total=8092124), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable2 scan count 1, logical reads: (regular=11 apf=0 total=11), physical reads: (regular=2 apf=0 total=2), apf IOs used=0
    Table: Worktable2 scan count 0, logical reads: (regular=10 apf=0 total=10), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable33 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable9 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable7 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable4 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable1 scan count 0, logical reads: (regular=8180641 apf=0 total=8180641), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable17 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable15 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable12 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable31 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable29 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable27 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable25 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable23 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable21 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable19 scan count 1, logical reads: (regular=4 apf=0 total=4), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    Table: Worktable2 scan count 0, logical reads: (regular=21 apf=0 total=21), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
    

    我希望以上内容能帮助其他人,以防他们遇到我遇到的类似问题。

    • 0

相关问题

  • 为什么同时使用 TRUNCATE 和 DROP?

  • 已经连接时是否有与 isql 等效的 -w ?

  • 如何从 isql 将参数传递给“SQL 脚本”

  • 如何识别具有指向 Sybase 中特定表的外键的表?

  • 如何在数据库中找到最新的 SQL 语句?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve