免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: gugong
打印 上一主题 下一主题

Sybase 调优问题(内存与磁盘 I/O) [复制链接]

论坛徽章:
0
11 [报告]
发表于 2006-01-09 12:04 |只看该作者
set showplan on
go
set statistics io,tim on
go
select getdate()
go
your query here
select get date()
go

Please check the 'cpu time','elapsed time', 'physical read' on different machines, I think on the slower one, you have more 'elapsed time', then check your disk io performance

论坛徽章:
0
12 [报告]
发表于 2006-01-09 12:05 |只看该作者
sorry,
set statistics io,time on

论坛徽章:
0
13 [报告]
发表于 2006-01-09 12:39 |只看该作者

  1. -bash-3.00$ isql -SRanan -Usa -P
  2. 1> set showplan on
  3. 2> go
  4. 1> set statistics io,time on
  5. 2> go

  6. QUERY PLAN FOR STATEMENT 1 (at line 1).


  7.     STEP 1
  8.         The type of query is SET STATISTICS ON.

  9. Total writes for this command: 0

  10. Execution Time 0.
  11. SQL Server cpu time: 0 ms.  SQL Server elapsed time: 6 ms.
  12. 1> select getdate()
  13. 2> go

  14. QUERY PLAN FOR STATEMENT 1 (at line 1).


  15.     STEP 1
  16.         The type of query is SELECT.

  17. Parse and Compile Time 0.
  18. SQL Server cpu time: 0 ms.

  19. --------------------------
  20.         Jan  9 2006 12:34PM
  21. Total writes for this command: 0

  22. Execution Time 0.
  23. SQL Server cpu time: 0 ms.  SQL Server elapsed time: 0 ms.

  24. (1 row affected)
  25. 1> use ESBIS
  26. 2> go
  27. QUERY PLAN FOR STATEMENT 1 (at line 1).


  28.     STEP 1
  29.         The type of query is USE DATABASE.

  30. Parse and Compile Time 0.
  31. SQL Server cpu time: 0 ms.
  32. Total writes for this command: 0

  33. Execution Time 0.
  34. SQL Server cpu time: 0 ms.  SQL Server elapsed time: 0 ms.
  35. 1> select convert(varchar(20),getdate(),9)
  36. 2> SELECT ReceiveID,StockID,ReceiveDate,SumVariety,Priority,(CASE (select count(*) from Prod_Dispense where (Status ='05'OR Status ='06') AND SourceID = r.ReceiveID) WHEN 0 then '04' else '05' END) AS Status,
  37. 3> (select max(distinct l.TempAreaID) + '区' from Logi_ReceiveList l where r.ReceiveID = l.ReceiveID) as TempAreaID,
  38. 4> ProvName,DeptName,(SELECT Distinct DealMode FROM Prod_Dispense WHERE SourceID  = r.ReceiveID) AS DealMode
  39. 5> FROM Logi_Receive r LEFT OUTER JOIN Bas_Prov ON Bas_Prov.ProvID = r.ProviderID LEFT OUTER JOIN Bas_DeptInfo ON Bas_DeptInfo.DeptID = r.FillDeptID
  40. 6> WHERE ReceiveID IN (SELECT Distinct SourceID FROM Prod_Dispense WHERE Status IN ('04','05'))
  41. 7> ORDER BY DealMode ASC,Priority desc, AuditDate ASC
  42. 8> select convert(varchar(20),getdate(),9)
  43. 9> go

  44. ...

  45. Table: Prod_Dispense scan count 1, logical reads: (regular=5717 apf=0
  46. total=5717), physical reads: (regular=5714 apf=0 total=5714), apf IOs used=0
  47. Table: Logi_ReceiveList scan count 202, logical reads: (regular=2998 apf=0
  48. total=2998), physical reads: (regular=676 apf=0 total=676), apf IOs used=0
  49. Table: Prod_Dispense scan count 1, logical reads: (regular=5717 apf=0
  50. total=5717), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  51. Table: Logi_Receive scan count 1, logical reads: (regular=1651 apf=0
  52. total=1651), physical reads: (regular=1603 apf=0 total=1603), apf IOs used=0
  53. Table: Bas_Prov scan count 9736, logical reads: (regular=29683 apf=0
  54. total=29683), physical reads: (regular=100 apf=0 total=100), apf IOs used=0
  55. Table: Bas_DeptInfo scan count 9736, logical reads: (regular=9740 apf=0
  56. total=9740), physical reads: (regular=3 apf=0 total=3), apf IOs used=0
  57. Table: Prod_Dispense scan count 1, logical reads: (regular=5717 apf=0
  58. total=5717), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  59. Table: Worktable1  scan count 202, logical reads: (regular=63186 apf=0
  60. total=63186), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  61. Table: Worktable2  scan count 202, logical reads: (regular=65238 apf=0
  62. total=65238), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  63. Table: Worktable3  scan count 0, logical reads: (regular=240 apf=0 total=240),
  64. physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  65. Table: Worktable4  scan count 9736, logical reads: (regular=21174 apf=0
  66. total=21174), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  67. Total writes for this command: 4216

  68. Execution Time 8.
  69. SQL Server cpu time: 800 ms.  SQL Server elapsed time: 35676 ms.

  70. (202 rows affected)

  71. --------------------
  72. Jan  9 2006 12:38:52
  73. Total writes for this command: 0

  74. Execution Time 0.
  75. SQL Server cpu time: 0 ms.  SQL Server elapsed time: 0 ms.

  76. (1 row affected)
  77. 1>

复制代码

论坛徽章:
0
14 [报告]
发表于 2006-01-09 12:42 |只看该作者
第二次

  1. 1> select convert(varchar(20),getdate(),9)
  2. 2> SELECT ReceiveID,StockID,ReceiveDate,SumVariety,Priority,(CASE (select count(*) from Prod_Dispense where (Status ='05'OR Status ='06') AND SourceID = r.ReceiveID) WHEN 0 then '04' else '05' END) AS Status,
  3. 3> (select max(distinct l.TempAreaID) + '区' from Logi_ReceiveList l where r.ReceiveID = l.ReceiveID) as TempAreaID,
  4. 4> ProvName,DeptName,(SELECT Distinct DealMode FROM Prod_Dispense WHERE SourceID  = r.ReceiveID) AS DealMode
  5. 5> FROM Logi_Receive r LEFT OUTER JOIN Bas_Prov ON Bas_Prov.ProvID = r.ProviderID LEFT OUTER JOIN Bas_DeptInfo ON Bas_DeptInfo.DeptID = r.FillDeptID
  6. 6> WHERE ReceiveID IN (SELECT Distinct SourceID FROM Prod_Dispense WHERE Status IN ('04','05'))
  7. 7> ORDER BY DealMode ASC,Priority desc, AuditDate ASC
  8. 8> select convert(varchar(20),getdate(),9)
  9. 9> go

  10. ...

  11. Table: Prod_Dispense scan count 1, logical reads: (regular=5717 apf=0
  12. total=5717), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  13. Table: Logi_ReceiveList scan count 202, logical reads: (regular=2998 apf=0
  14. total=2998), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  15. Table: Prod_Dispense scan count 1, logical reads: (regular=5717 apf=0
  16. total=5717), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  17. Table: Logi_Receive scan count 1, logical reads: (regular=1651 apf=0
  18. total=1651), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  19. Table: Bas_Prov scan count 9736, logical reads: (regular=29683 apf=0
  20. total=29683), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  21. Table: Bas_DeptInfo scan count 9736, logical reads: (regular=9740 apf=0
  22. total=9740), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  23. Table: Prod_Dispense scan count 1, logical reads: (regular=5717 apf=0
  24. total=5717), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  25. Table: Worktable1  scan count 202, logical reads: (regular=63186 apf=0
  26. total=63186), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  27. Table: Worktable2  scan count 202, logical reads: (regular=65238 apf=0
  28. total=65238), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  29. Table: Worktable3  scan count 0, logical reads: (regular=240 apf=0 total=240),
  30. physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  31. Table: Worktable4  scan count 9736, logical reads: (regular=21174 apf=0
  32. total=21174), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  33. Total writes for this command: 4741

  34. Execution Time 9.
  35. SQL Server cpu time: 900 ms.  SQL Server elapsed time: 4323 ms.

  36. (202 rows affected)

  37. --------------------
  38. Jan  9 2006 12:41:35
  39. Total writes for this command: 0

  40. Execution Time 0.
  41. SQL Server cpu time: 0 ms.  SQL Server elapsed time: 0 ms.

  42. (1 row affected)


复制代码

论坛徽章:
0
15 [报告]
发表于 2006-01-09 12:43 |只看该作者
中间 ... 省略的是:


  1. 9> go

  2. QUERY PLAN FOR STATEMENT 1 (at line 1).


  3.     STEP 1
  4.         The type of query is SELECT.


  5. QUERY PLAN FOR STATEMENT 2 (at line 2).


  6.     STEP 1
  7.         The type of query is INSERT.
  8.         The update mode is direct.
  9.         Worktable1 created for REFORMATTING.

  10.         FROM TABLE
  11.             Prod_Dispense
  12.         Nested iteration.
  13.         Table Scan.
  14.         Forward scan.
  15.         Positioning at start of table.
  16.         Using I/O Size 2 Kbytes for data pages.
  17.         With LRU Buffer Replacement Strategy for data pages.
  18.         TO TABLE
  19.             Worktable1.

  20.     STEP 2
  21.         The type of query is INSERT.
  22.         The update mode is direct.
  23.         Worktable2 created for REFORMATTING.

  24.         FROM TABLE
  25.             Prod_Dispense
  26.         Nested iteration.
  27.         Table Scan.
  28.         Forward scan.
  29.         Positioning at start of table.
  30.         Using I/O Size 2 Kbytes for data pages.
  31.         With LRU Buffer Replacement Strategy for data pages.
  32.         TO TABLE
  33.             Worktable2.

  34.     STEP 3
  35.         The type of query is INSERT.
  36.         The update mode is direct.
  37.         Worktable4 created for REFORMATTING.

  38.         FROM TABLE
  39.             Prod_Dispense
  40.         Nested iteration.
  41.         Table Scan.
  42.         Forward scan.
  43.         Positioning at start of table.
  44.         Using I/O Size 2 Kbytes for data pages.
  45.         With LRU Buffer Replacement Strategy for data pages.
  46.         TO TABLE
  47.             Worktable4.

  48.     STEP 4
  49.         The type of query is INSERT.
  50.         The update mode is direct.
  51.         Worktable3 created, in allpages locking mode, for ORDER BY.

  52.         FROM TABLE
  53.             Logi_Receive
  54.             r
  55.         Nested iteration.
  56.         Table Scan.
  57.         Forward scan.
  58.         Positioning at start of table.
  59.         Using I/O Size 2 Kbytes for data pages.
  60.         With LRU Buffer Replacement Strategy for data pages.

  61.         FROM TABLE
  62.             Bas_Prov
  63.         Nested iteration.
  64.         Index : Bas_Prov_x
  65.         Forward scan.
  66.         Positioning by key.
  67.         Keys are:
  68.             ProvID  ASC
  69.         Using I/O Size 2 Kbytes for index leaf pages.
  70.         With LRU Buffer Replacement Strategy for index leaf pages.
  71.         Using I/O Size 2 Kbytes for data pages.
  72.         With LRU Buffer Replacement Strategy for data pages.

  73.         FROM TABLE
  74.             Bas_DeptInfo
  75.         Nested iteration.
  76.         Index : PK_BAS_DEPTINFO
  77.         Forward scan.
  78.         Positioning by key.
  79.         Keys are:
  80.             DeptID  ASC
  81.         Using I/O Size 2 Kbytes for index leaf pages.
  82.         With LRU Buffer Replacement Strategy for index leaf pages.
  83.         Using I/O Size 2 Kbytes for data pages.
  84.         With LRU Buffer Replacement Strategy for data pages.

  85.         FROM TABLE
  86.             Worktable4.
  87.         EXISTS TABLE : nested iteration.
  88.         Using Clustered Index.
  89.         Forward scan.
  90.         Positioning by key.

  91.         Run subquery 1 (at nesting level 1).

  92.         Run subquery 2 (at nesting level 1).

  93.         Run subquery 3 (at nesting level 1).
  94.         Using I/O Size 2 Kbytes for data pages.
  95.         With LRU Buffer Replacement Strategy for data pages.
  96.         TO TABLE
  97.             Worktable3.

  98.     STEP 5
  99.         The type of query is SELECT.
  100.         This step involves sorting.

  101.         FROM TABLE
  102.             Worktable3.
  103.         Using GETSORTED
  104.         Table Scan.
  105.         Forward scan.
  106.         Positioning at start of table.
  107.         Using I/O Size 2 Kbytes for data pages.
  108.         With MRU Buffer Replacement Strategy for data pages.
  109.     STEP 1

  110. NESTING LEVEL 1 SUBQUERIES FOR STATEMENT 2.

  111.   QUERY PLAN FOR SUBQUERY 1 (at nesting level 1 and at line 2).

  112.     Correlated Subquery.
  113.     Subquery under an EXPRESSION predicate.


  114.     STEP 1
  115.         The type of query is SELECT.
  116.         Evaluate Ungrouped COUNT AGGREGATE.

  117.         FROM TABLE
  118.             Worktable1.
  119.         Nested iteration.
  120.         Using Clustered Index.
  121.         Forward scan.
  122.         Positioning by key.
  123.         Using I/O Size 2 Kbytes for data pages.
  124.         With LRU Buffer Replacement Strategy for data pages.

  125.   END OF QUERY PLAN FOR SUBQUERY 1.


  126.   QUERY PLAN FOR SUBQUERY 2 (at nesting level 1 and at line 3).

  127.     Correlated Subquery.
  128.     Subquery under an EXPRESSION predicate.


  129.     STEP 1
  130.         The type of query is SELECT.
  131.         Evaluate Ungrouped MAXIMUM AGGREGATE.

  132.         FROM TABLE
  133.             Logi_ReceiveList
  134.             l
  135.         Nested iteration.
  136.         Index : PK_LOGI_RECEIVEILIST
  137.         Forward scan.
  138.         Positioning by key.
  139.         Keys are:
  140.             ReceiveID  ASC
  141.         Using I/O Size 2 Kbytes for index leaf pages.
  142.         With LRU Buffer Replacement Strategy for index leaf pages.
  143.         Using I/O Size 2 Kbytes for data pages.
  144.         With LRU Buffer Replacement Strategy for data pages.

  145.     STEP 2
  146.         The type of query is SELECT.
  147.         Evaluate Ungrouped ONCE AGGREGATE.

  148.   END OF QUERY PLAN FOR SUBQUERY 2.


  149.   QUERY PLAN FOR SUBQUERY 3 (at nesting level 1 and at line 4).

  150.     Correlated Subquery.
  151.     Subquery under an EXPRESSION predicate.


  152.     STEP 1
  153.         The type of query is SELECT.
  154.         Evaluate Ungrouped ONCE-UNIQUE AGGREGATE.

  155.         FROM TABLE
  156.             Worktable2.
  157.         Nested iteration.
  158.         Using Clustered Index.
  159.         Forward scan.
  160.         Positioning by key.
  161.         Using I/O Size 2 Kbytes for data pages.
  162.         With LRU Buffer Replacement Strategy for data pages.

  163.   END OF QUERY PLAN FOR SUBQUERY 3.



  164. QUERY PLAN FOR STATEMENT 3 (at line 8).


  165.     STEP 1
  166.         The type of query is SELECT.

  167. Parse and Compile Time 0.
  168. SQL Server cpu time: 0 ms.

  169. --------------------
  170. Jan  9 2006 12:41:31
  171. Total writes for this command: 0

  172. Execution Time 0.
  173. SQL Server cpu time: 0 ms.  SQL Server elapsed time: 0 ms.

  174. (1 row affected)
  175. The sort for Worktable1 is done in Serial


  176. The sort for Worktable2 is done in Serial


  177. The sort for Worktable4 is done in Serial


  178. The sort for Worktable3 is done in Serial


  179. ReceiveID          StockID            ReceiveDate                SumVariety
  180.          Priority    Status TempAreaID
  181.          ProvName                                                                                                                                                                                    
  182.          DeptName                                                                                                                                                                                    
  183.          DealMode
  184. ------------------ ------------------ -------------------------- -----------
  185.          ----------- ------ ------------------------------------------
  186.          --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  187.          ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  188.          --------

复制代码

论坛徽章:
0
16 [报告]
发表于 2006-01-09 13:01 |只看该作者
我感觉是临时库的问题?
临时库的配置如何,用的什么设备?试试把临时库建在内存里。

方便的法,把两个环境的配置及做这个大动作时的sysmon结果贴来看看/

[ 本帖最后由 zhhui2000 于 2006-1-9 13:09 编辑 ]

论坛徽章:
0
17 [报告]
发表于 2006-01-09 13:10 |只看该作者
上面是 4 CPU 、16 G 内存、SCSI 机器的。

时间在 4-5 秒之间


下面是 2CPU、8G 内存、SATAII 机器的:

时间在 1-2 秒之间

  1. 9> select getdate()
  2. 10> go

  3. QUERY PLAN FOR STATEMENT 1 (at line 1).


  4.     STEP 1
  5.         The type of query is SELECT.


  6. QUERY PLAN FOR STATEMENT 2 (at line 2).


  7.     STEP 1
  8.         The type of query is INSERT.
  9.         The update mode is direct.
  10.         Worktable1 created for REFORMATTING.

  11.         FROM TABLE
  12.             Prod_Dispense
  13.         Nested iteration.
  14.         Table Scan.
  15.         Forward scan.
  16.         Positioning at start of table.
  17.         Using I/O Size 2 Kbytes for data pages.
  18.         With LRU Buffer Replacement Strategy for data pages.
  19.         TO TABLE
  20.             Worktable1.

  21.     STEP 2
  22.         The type of query is INSERT.
  23.         The update mode is direct.
  24.         Worktable2 created for REFORMATTING.

  25.         FROM TABLE
  26.             Prod_Dispense
  27.         Nested iteration.
  28.         Table Scan.
  29.         Forward scan.
  30.         Positioning at start of table.
  31.         Using I/O Size 2 Kbytes for data pages.
  32.         With LRU Buffer Replacement Strategy for data pages.
  33.         TO TABLE
  34.             Worktable2.

  35.     STEP 3
  36.         The type of query is INSERT.
  37.         The update mode is direct.
  38.         Worktable4 created for REFORMATTING.

  39.         FROM TABLE
  40.             Prod_Dispense
  41.         Nested iteration.
  42.         Table Scan.
  43.         Forward scan.
  44.         Positioning at start of table.
  45.         Using I/O Size 2 Kbytes for data pages.
  46.         With LRU Buffer Replacement Strategy for data pages.
  47.         TO TABLE
  48.             Worktable4.

  49.     STEP 4
  50.         The type of query is INSERT.
  51.         The update mode is direct.
  52.         Worktable3 created, in allpages locking mode, for ORDER BY.

  53.         FROM TABLE
  54.             Logi_Receive
  55.             r
  56.         Nested iteration.
  57.         Table Scan.
  58.         Forward scan.
  59.         Positioning at start of table.
  60.         Using I/O Size 2 Kbytes for data pages.
  61.         With LRU Buffer Replacement Strategy for data pages.

  62.         FROM TABLE
  63.             Bas_Prov
  64.         Nested iteration.
  65.         Index : Bas_Prov_x
  66.         Forward scan.
  67.         Positioning by key.
  68.         Keys are:
  69.             ProvID  ASC
  70.         Using I/O Size 2 Kbytes for index leaf pages.
  71.         With LRU Buffer Replacement Strategy for index leaf pages.
  72.         Using I/O Size 2 Kbytes for data pages.
  73.         With LRU Buffer Replacement Strategy for data pages.

  74.         FROM TABLE
  75.             Bas_DeptInfo
  76.         Nested iteration.
  77.         Index : PK_BAS_DEPTINFO
  78.         Forward scan.
  79.         Positioning by key.
  80.         Keys are:
  81.             DeptID  ASC
  82.         Using I/O Size 2 Kbytes for index leaf pages.
  83.         With LRU Buffer Replacement Strategy for index leaf pages.
  84.         Using I/O Size 2 Kbytes for data pages.
  85.         With LRU Buffer Replacement Strategy for data pages.

  86.         FROM TABLE
  87.             Worktable4.
  88.         EXISTS TABLE : nested iteration.
  89.         Using Clustered Index.
  90.         Forward scan.
  91.         Positioning by key.

  92.         Run subquery 1 (at nesting level 1).

  93.         Run subquery 2 (at nesting level 1).

  94.         Run subquery 3 (at nesting level 1).
  95.         Using I/O Size 2 Kbytes for data pages.
  96.         With LRU Buffer Replacement Strategy for data pages.
  97.         TO TABLE
  98.             Worktable3.

  99.     STEP 5
  100.         The type of query is SELECT.
  101.         This step involves sorting.

  102.         FROM TABLE
  103.             Worktable3.
  104.         Using GETSORTED
  105.         Table Scan.
  106.         Forward scan.
  107.         Positioning at start of table.
  108.         Using I/O Size 2 Kbytes for data pages.
  109.         With MRU Buffer Replacement Strategy for data pages.
  110.     STEP 1

  111. NESTING LEVEL 1 SUBQUERIES FOR STATEMENT 2.

  112.   QUERY PLAN FOR SUBQUERY 1 (at nesting level 1 and at line 2).

  113.     Correlated Subquery.
  114.     Subquery under an EXPRESSION predicate.


  115.     STEP 1
  116.         The type of query is SELECT.
  117.         Evaluate Ungrouped COUNT AGGREGATE.

  118.         FROM TABLE
  119.             Worktable1.
  120.         Nested iteration.
  121.         Using Clustered Index.
  122.         Forward scan.
  123.         Positioning by key.
  124.         Using I/O Size 2 Kbytes for data pages.
  125.         With LRU Buffer Replacement Strategy for data pages.

  126.   END OF QUERY PLAN FOR SUBQUERY 1.


  127.   QUERY PLAN FOR SUBQUERY 2 (at nesting level 1 and at line 3).

  128.     Correlated Subquery.
  129.     Subquery under an EXPRESSION predicate.


  130.     STEP 1
  131.         The type of query is SELECT.
  132.         Evaluate Ungrouped MAXIMUM AGGREGATE.

  133.         FROM TABLE
  134.             Logi_ReceiveList
  135.             l
  136.         Nested iteration.
  137.         Index : PK_LOGI_RECEIVEILIST
  138.         Forward scan.
  139.         Positioning by key.
  140.         Keys are:
  141.             ReceiveID  ASC
  142.         Using I/O Size 2 Kbytes for index leaf pages.
  143.         With LRU Buffer Replacement Strategy for index leaf pages.
  144.         Using I/O Size 2 Kbytes for data pages.
  145.         With LRU Buffer Replacement Strategy for data pages.

  146.     STEP 2
  147.         The type of query is SELECT.
  148.         Evaluate Ungrouped ONCE AGGREGATE.

  149.   END OF QUERY PLAN FOR SUBQUERY 2.


  150.   QUERY PLAN FOR SUBQUERY 3 (at nesting level 1 and at line 4).

  151.     Correlated Subquery.
  152.     Subquery under an EXPRESSION predicate.


  153.     STEP 1
  154.         The type of query is SELECT.
  155.         Evaluate Ungrouped ONCE-UNIQUE AGGREGATE.

  156.         FROM TABLE
  157.             Worktable2.
  158.         Nested iteration.
  159.         Using Clustered Index.
  160.         Forward scan.
  161.         Positioning by key.
  162.         Using I/O Size 2 Kbytes for data pages.
  163.         With LRU Buffer Replacement Strategy for data pages.

  164.   END OF QUERY PLAN FOR SUBQUERY 3.



  165. QUERY PLAN FOR STATEMENT 3 (at line 8).


  166.     STEP 1
  167.         The type of query is SELECT.


  168. QUERY PLAN FOR STATEMENT 4 (at line 9).


  169.     STEP 1
  170.         The type of query is SELECT.

  171. Parse and Compile Time 0.
  172. SQL Server cpu time: 0 ms.

  173. --------------------
  174. Jan  9 2006  1:07:46
  175. Total writes for this command: 0

  176. Execution Time 0.
  177. SQL Server cpu time: 0 ms.  SQL Server elapsed time: 0 ms.

  178. (1 row affected)
  179. The sort for Worktable1 is done in Serial


  180. The sort for Worktable2 is done in Serial


  181. The sort for Worktable4 is done in Serial


  182. The sort for Worktable3 is done in Serial


  183. ReceiveID          StockID            ReceiveDate                SumVariety
  184.          Priority    Status TempAreaID
  185.          ProvName                                                                                                                                                                       
  186.          DeptName                                                                                                                                                                       
  187.          DealMode
  188. ------------------ ------------------ -------------------------- -----------
  189.          ----------- ------ ------------------------------------------
  190.          --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  191.          ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  192.          --------

  193. .......................


  194.          03
  195. Table: Prod_Dispense scan count 1, logical reads: (regular=5717 apf=0
  196. total=5717), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  197. Table: Logi_ReceiveList scan count 202, logical reads: (regular=2998 apf=0
  198. total=2998), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  199. Table: Prod_Dispense scan count 1, logical reads: (regular=5717 apf=0
  200. total=5717), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  201. Table: Logi_Receive scan count 1, logical reads: (regular=1651 apf=0
  202. total=1651), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  203. Table: Bas_Prov scan count 9736, logical reads: (regular=29683 apf=0
  204. total=29683), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  205. Table: Bas_DeptInfo scan count 9736, logical reads: (regular=9740 apf=0
  206. total=9740), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  207. Table: Prod_Dispense scan count 1, logical reads: (regular=5717 apf=0
  208. total=5717), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  209. Table: Worktable1  scan count 202, logical reads: (regular=63186 apf=0
  210. total=63186), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  211. Table: Worktable2  scan count 202, logical reads: (regular=65238 apf=0
  212. total=65238), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  213. Table: Worktable3  scan count 0, logical reads: (regular=240 apf=0 total=240),
  214. physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  215. Table: Worktable4  scan count 9736, logical reads: (regular=21174 apf=0
  216. total=21174), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
  217. Total writes for this command: 4741

  218. Execution Time 9.
  219. SQL Server cpu time: 900 ms.  SQL Server elapsed time: 1183 ms.

  220. (202 rows affected)

  221. --------------------
  222. Jan  9 2006  1:07:47
  223. Total writes for this command: 0

  224. Execution Time 0.
  225. SQL Server cpu time: 0 ms.  SQL Server elapsed time: 0 ms.

  226. (1 row affected)

  227. --------------------------
  228.         Jan  9 2006  1:07PM
  229. Total writes for this command: 0

  230. Execution Time 0.
  231. SQL Server cpu time: 0 ms.  SQL Server elapsed time: 0 ms.

  232. (1 row affected)

复制代码

时间是 1183 ms

论坛徽章:
4
2015年亚洲杯之阿联酋
日期:2015-03-10 10:32:022015年亚洲杯之阿曼
日期:2015-03-10 14:53:222015亚冠之水原三星
日期:2015-07-18 15:40:262015亚冠之塔什干棉农
日期:2015-07-27 20:52:05
18 [报告]
发表于 2006-01-09 13:11 |只看该作者
wow,how complex the sql is.as you decribed above,first execution,some large table did more physical I/Os than second time.SQL Server elapsed time in second time fell into 4323 ms probably because less physical happened.I am not clear what you try to say.
btw:don't give such complex sql to ASE, sometime it will fail to get it work efficiently.

论坛徽章:
0
19 [报告]
发表于 2006-01-09 14:45 |只看该作者
你说的对。

我现在所疑问的是,在 scci 硬盘和 sata II 硬盘所表现出来的差异是如此的大。

论坛徽章:
0
20 [报告]
发表于 2006-01-10 09:19 |只看该作者
The elapsed time is much bigger on one machine than another, indicating that Adaptive Server spent
some time processing other tasks or waiting for disk or network I/O to complete. Please check the disks are configured properly, such as dsync or preferred plex (if you are using VCS).
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP