473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

CPU Util on a Stored Proc

Hello people,

Thanks to Serge, PM, Knut and a host of others I have now successfully
completed my very first SQL Stored Procedure. Takes some 13mins or so
to run, but that was expected as it does a fairly significant number
of small single select and inserts from various cursors. I am very
pleased with the results and can find no errors after a few days
debugging a couple of never ending loops.

Interestingly though, while processing it registers virtually nil CPU
usage, somthing in the order of 5-7% at best which confuses me to be
honest. In truth the selects are all very basic, no joins, on small
tables. One cursor has to store 28000 records and a 'while' statement
then loops through those opening 3 other nested 'while' cursors.

I had a problem with the log thrashing but turned that off at the
table via not logging which solved that. Disk activity is fine as I
stood in fornt of the server while it was running and the disks are
only active say every 4 secs or so and only very very slightly at
that. Windows monitor shows nothing excessive, I ran all the monitor
switches and viewed virtually all of the avaible keys via that and can
find nothing that would indicate a problem at all. Indeed there
doesnt appear to be one .. heh

I was just wondering why such a small cpu utilization is all.

Ive pasted the results of the various snapshots .. sorry for the size.

Could some kind soul take a look and see if anything glaring stands
out.

Many thanks,

Tim

I know it is an SMS database, but for now that will have to suffice :)

Database Snapshot

Database name = DBNAME
Database path = D:\DB2\NODE0000\SQL00003\
Input database alias =
Database status = Active
Catalog database partition number = 0
Catalog network node name =
Operating system running at database server= NT
Location of the database = Local
First database connect timestamp = Not Collected
Last reset timestamp = Not Collected
Last backup timestamp = Not Collected
Snapshot timestamp = 03-03-2004
15:07:39.408808

High water mark for connections = 3
Application connects = 5
Secondary connects total = 0
Applications connected currently = 1
Appls. executing in db manager currently = 0
Agents associated with applications = 6
Maximum agents associated with applications= 8
Maximum coordinating agents = 3

Locks held currently = 3
Lock waits = 6
Time database waited on locks (ms) = 46284
Lock list memory in use (Bytes) = 4640
Deadlocks detected = 0
Lock escalations = 0
Exclusive lock escalations = 0
Agents currently waiting on locks = 0
Lock Timeouts = 0
Number of indoubt transactions = 0

Total Private Sort heap allocated = 0
Total Shared Sort heap allocated = 0
Shared Sort heap high water mark = 2556
Total sorts = 497348
Total sort time (ms) = 178365
Sort overflows = 0
Active sorts = 0

Buffer pool data logical reads = 8750371
Buffer pool data physical reads = 1
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Asynchronous pool data page reads = 0
Buffer pool data writes = 1422
Asynchronous pool data page writes = 0
Buffer pool index logical reads = 6892085
Buffer pool index physical reads = 379
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
Asynchronous pool index page reads = 0
Buffer pool index writes = 1533
Asynchronous pool index page writes = 0
Total buffer pool read time (ms) = 0
Total buffer pool write time (ms) = 0
Total elapsed asynchronous read time = 0
Total elapsed asynchronous write time = 0
Asynchronous data read requests = 0
Asynchronous index read requests = 0
No victim buffers available = 0
LSN Gap cleaner triggers = 0
Dirty page steal cleaner triggers = 0
Dirty page threshold cleaner triggers = 0
Time waited for prefetch (ms) = 0
Unread prefetch pages = 0
Direct reads = 352
Direct writes = 3584
Direct read requests = 86
Direct write requests = 14
Direct reads elapsed time (ms) = 0
Direct write elapsed time (ms) = 24002381
Database files closed = 0
Data pages copied to extended storage = 0
Index pages copied to extended storage = 0
Data pages copied from extended storage = 0
Index pages copied from extended storage = 0

Host execution elapsed time = Not Collected

Commit statements attempted = 60
Rollback statements attempted = 1
Dynamic statements attempted = 984930
Static statements attempted = 7371115
Failed statement operations = 1
Select SQL statements executed = 5331310
Update/Insert/Delete statements executed = 2317654
DDL statements executed = 104

Internal automatic rebinds = 0
Internal rows deleted = 0
Internal rows inserted = 0
Internal rows updated = 0
Internal commits = 6
Internal rollbacks = 0
Internal rollbacks due to deadlock = 0

Rows deleted = 2178099
Rows inserted = 2267288
Rows updated = 0
Rows selected = 8530280
Rows read = 16117740
Binds/precompiles attempted = 0

Log space available to the database (Bytes)= 394402379
Log space used by the database (Bytes) = 13597621
Maximum secondary log space used (Bytes) = 0
Maximum total log space used (Bytes) = 30677107
Secondary logs allocated currently = 0
Log pages read = 0
Log pages written = 3491
Appl id holding the oldest transaction = 11

Package cache lookups = 9096876
Package cache inserts = 10376
Package cache overflows = 0
Package cache high water mark (Bytes) = 4072217
Application section lookups = 10507392
Application section inserts = 52265

Catalog cache lookups = 20580
Catalog cache inserts = 39
Catalog cache overflows = 0
Catalog cache high water mark = 0

Workspace Information

Shared high water mark = 19215742
Corresponding shared overflows = 0
Total shared section inserts = 5401
Total shared section lookups = 236232
Private high water mark = 1425616
Corresponding private overflows = 0
Total private section inserts = 46864
Total private section lookups = 2295176

Number of hash joins = 0
Number of hash loops = 0
Number of hash join overflows = 0
Number of small hash join overflows = 0

db2 => GET SNAPSHOT FOR ALL BUFFERPOOLS

Bufferpool Snapshot

Bufferpool name = IBMDEFAULTBP
Database name = DBNAME
Database path = D:\DB2\NODE0000\SQL00003\
Input database alias =
Snapshot timestamp = 03-03-2004
15:10:49.592594

Buffer pool data logical reads = 314
Buffer pool data physical reads = 0
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Buffer pool data writes = 0
Buffer pool index logical reads = 488
Buffer pool index physical reads = 0
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
Total buffer pool read time (ms) = 0
Total buffer pool write time (ms) = 0
Asynchronous pool data page reads = 0
Asynchronous pool data page writes = 0
Buffer pool index writes = 0
Asynchronous pool index page reads = 0
Asynchronous pool index page writes = 0
Total elapsed asynchronous read time = 0
Total elapsed asynchronous write time = 0
Asynchronous data read requests = 0
Asynchronous index read requests = 0
No victim buffers available = 0
Direct reads = 352
Direct writes = 0
Direct read requests = 86
Direct write requests = 0
Direct reads elapsed time (ms) = 0
Direct write elapsed time (ms) = 0
Database files closed = 0
Data pages copied to extended storage = 0
Index pages copied to extended storage = 0
Data pages copied from extended storage = 0
Index pages copied from extended storage = 0
Unread prefetch pages = 0
Vectored IOs = 0
Pages from vectored IOs = 0
Block IOs = 0
Pages from block IOs = 0
Physical page maps = 0

Node number = 0
Tablespaces using bufferpool = 3
Alter bufferpool information:
Pages left to remove = 0
Current size = 10000
Post-alter size = 10000
Bufferpool Snapshot

Bufferpool name = RAWDATA
Database name = DBNAME
Database path = D:\DB2\NODE0000\SQL00003\
Input database alias =
Snapshot timestamp = 03-03-2004
15:10:49.592594

Buffer pool data logical reads = 6565153
Buffer pool data physical reads = 1
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Buffer pool data writes = 0
Buffer pool index logical reads = 1911061
Buffer pool index physical reads = 0
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
Total buffer pool read time (ms) = 0
Total buffer pool write time (ms) = 0
Asynchronous pool data page reads = 0
Asynchronous pool data page writes = 0
Buffer pool index writes = 0
Asynchronous pool index page reads = 0
Asynchronous pool index page writes = 0
Total elapsed asynchronous read time = 0
Total elapsed asynchronous write time = 0
Asynchronous data read requests = 0
Asynchronous index read requests = 0
No victim buffers available = 0
Direct reads = 0
Direct writes = 0
Direct read requests = 0
Direct write requests = 0
Direct reads elapsed time (ms) = 0
Direct write elapsed time (ms) = 0
Database files closed = 0
Data pages copied to extended storage = 0
Index pages copied to extended storage = 0
Data pages copied from extended storage = 0
Index pages copied from extended storage = 0
Unread prefetch pages = 0
Vectored IOs = 0
Pages from vectored IOs = 0
Block IOs = 0
Pages from block IOs = 0
Physical page maps = 0

Node number = 0
Tablespaces using bufferpool = 1
Alter bufferpool information:
Pages left to remove = 0
Current size = 10000
Post-alter size = 10000
Bufferpool Snapshot

Bufferpool name = RESULTS
Database name = DBNAME
Database path = D:\DB2\NODE0000\SQL00003\
Input database alias =
Snapshot timestamp = 03-03-2004
15:10:49.592594

Buffer pool data logical reads = 2184904
Buffer pool data physical reads = 0
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Buffer pool data writes = 1422
Buffer pool index logical reads = 4980536
Buffer pool index physical reads = 379
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
Total buffer pool read time (ms) = 0
Total buffer pool write time (ms) = 0
Asynchronous pool data page reads = 0
Asynchronous pool data page writes = 0
Buffer pool index writes = 1533
Asynchronous pool index page reads = 0
Asynchronous pool index page writes = 0
Total elapsed asynchronous read time = 0
Total elapsed asynchronous write time = 0
Asynchronous data read requests = 0
Asynchronous index read requests = 0
No victim buffers available = 0
Direct reads = 0
Direct writes = 3584
Direct read requests = 0
Direct write requests = 14
Direct reads elapsed time (ms) = 0
Direct write elapsed time (ms) = 24002381
Database files closed = 0
Data pages copied to extended storage = 0
Index pages copied to extended storage = 0
Data pages copied from extended storage = 0
Index pages copied from extended storage = 0
Unread prefetch pages = 0
Vectored IOs = 0
Pages from vectored IOs = 0
Block IOs = 0
Pages from block IOs = 0
Physical page maps = 0

Node number = 0
Tablespaces using bufferpool = 1
Alter bufferpool information:
Pages left to remove = 0
Current size = 25000
Post-alter size = 25000

db2 => GET SNAPSHOT FOR APPLICATIONS ON DBNAME

Application Snapshot

Application handle = 11
Application status = UOW Waiting
Status change time = Not Collected
Application code page = 1252
Application country/region code = 1
DUOW correlation token = *LOCAL.DB2.0115C3193403
Application name = db2bp.exe
Application ID = *LOCAL.DB2.0115C3193403
Sequence number = 0055
TP Monitor client user ID =
TP Monitor client workstation name =
TP Monitor client application name =
TP Monitor client accounting string =

Connection request start timestamp = Not Collected
Connect request completion timestamp = Not Collected
Application idle time = 0
CONNECT Authorization ID = DB2ADMIN
Client login ID = DB2ADMIN
Configuration NNAME of client =
Client database manager product ID = SQL08014
Process ID of client application = 1772
Platform of client application = NT
Communication protocol of client = Local Client

Inbound communication address = *LOCAL.DB2

Database name = DBNAME
Database path = D:\DB2\NODE0000\SQL00003\
Client database alias = DBNAME
Input database alias = DBNAME
Last reset timestamp = Not Collected
Snapshot timestamp = 03-03-2004
15:16:52.675489
The highest authority level granted =
Direct DBADM authority
Direct CREATETAB authority
Direct BINDADD authority
Direct CONNECT authority
Direct CREATE_NOT_FENC authority
Direct LOAD authority
Direct IMPLICIT_SCHEMA authority
Direct CREATE_EXT_RT authority
Direct QUIESCE_CONN authority
Indirect SYSADM authority
Indirect DBADM authority
Indirect CREATETAB authority
Indirect BINDADD authority
Indirect CONNECT authority
Indirect CREATE_NOT_FENC authority
Indirect IMPLICIT_SCHEMA authority
Indirect LOAD authority
Indirect CREATE_EXT_RT authority
Indirect QUIESCE_CONN authority
Coordinating database partition number = 0
Current database partition number = 0
Coordinator agent process or thread ID = 1696
Agents stolen = 0
Agents waiting on locks = 0
Maximum associated agents = 7
Priority at which application agents work = 0
Priority type = Dynamic

Locks held by application = 2
Lock waits since connect = 3
Time application waited on locks (ms) = 1
Deadlocks detected = 0
Lock escalations = 0
Exclusive lock escalations = 0
Number of Lock Timeouts since connected = 0
Total time UOW waited on locks (ms) = 0

Total sorts = 497340
Total sort time (ms) = 178365
Total sort overflows = 0

Data pages copied to extended storage = 0
Index pages copied to extended storage = 0
Data pages copied from extended storage = 0
Index pages copied from extended storage = 0
Buffer pool data logical reads = 8750371
Buffer pool data physical reads = 1
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Buffer pool data writes = 1422
Buffer pool index logical reads = 6892085
Buffer pool index physical reads = 379
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
Buffer pool index writes = 1533
Total buffer pool read time (ms) = 0
Total buffer pool write time (ms) = 0
Time waited for prefetch (ms) = 0
Unread prefetch pages = 0
Direct reads = 352
Direct writes = 3584
Direct read requests = 86
Direct write requests = 14
Direct reads elapsed time (ms) = 0
Direct write elapsed time (ms) = 24002381

Number of SQL requests since last commit = 0
Commit statements = 54
Rollback statements = 0
Dynamic SQL statements attempted = 984906
Static SQL statements attempted = 7371108
Failed statement operations = 1
Select SQL statements executed = 5331303
Update/Insert/Delete statements executed = 2317654
DDL statements executed = 104
Internal automatic rebinds = 0
Internal rows deleted = 0
Internal rows inserted = 0
Internal rows updated = 0
Internal commits = 1
Internal rollbacks = 0
Internal rollbacks due to deadlock = 0
Binds/precompiles attempted = 0
Rows deleted = 2178099
Rows inserted = 2267288
Rows updated = 0
Rows selected = 8525127
Rows read = 16111061
Rows written = 4445387

UOW log space used (Bytes) = 302
Previous UOW completion timestamp = Not Collected
Elapsed time of last completed uow (sec.ms)= Not Collected
UOW start timestamp = Not Collected
UOW stop timestamp = Not Collected
UOW completion status =

Open remote cursors = 0
Open remote cursors with blocking = 0
Rejected Block Remote Cursor requests = 0
Accepted Block Remote Cursor requests = 378627
Open local cursors = 0
Open local cursors with blocking = 0
Total User CPU Time used by agent (s) = Not Collected
Total System CPU Time used by agent (s) = Not Collected
Host execution elapsed time = Not Collected

Package cache lookups = 9096865
Package cache inserts = 10371
Application section lookups = 10507354
Application section inserts = 52250
Catalog cache lookups = 20549
Catalog cache inserts = 25
Catalog cache overflows = 0
Catalog cache high water mark = 0

Workspace Information

Shared high water mark = 19215742
Total shared overflows = 0
Total shared section inserts = 5397
Total shared section lookups = 236228
Private high water mark = 1425616
Total private overflows = 0
Total private section inserts = 46853
Total private section lookups = 2295159

Most recent operation = Execute
Most recent operation start timestamp = Not Collected
Most recent operation stop timestamp = Not Collected
Agents associated with the application = 6
Number of hash joins = 0
Number of hash loops = 0
Number of hash join overflows = 0
Number of small hash join overflows = 0
Statement type = Dynamic SQL Statement
Statement = Execute
Section number = 1
Application creator = NULLID
Package name = SQLC2E03
Consistency Token = AAAAAJHR
Package Version ID =
Cursor name = SQLCUR1
Statement database partition number = 0
Statement start timestamp = Not Collected
Statement stop timestamp = Not Collected
Elapsed time of last completed stmt(sec.ms)= Not Collected
Total user CPU time = Not Collected
Total system CPU time = Not Collected
SQL compiler cost estimate in timerons = 1
SQL compiler cardinality estimate = 1
Degree of parallelism requested = 1
Number of agents working on statement = 1
Number of subagents created for statement = 1
Statement sorts = 0
Total sort time = 0
Sort overflows = 0
Rows read = 0
Rows written = 0
Rows deleted = 0
Rows updated = 0
Rows inserted = 0
Rows fetched = 0
Buffer pool data logical reads = 2
Buffer pool data physical reads = 0
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Buffer pool index logical reads = 2
Buffer pool index physical reads = 0
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
Blocking cursor = NO
Dynamic SQL statement text:
CALL ASSC_RULE_TO_SUBJECT()
Memory usage for application:

Database partition number = 0
Agent process/thread ID = 1696
Memory Pool Type = Application Heap
Current size (bytes) = 1785856
High water mark (bytes) = 1851392
Maximum size allowed (bytes) = 2326528

Database partition number = 0
Agent process/thread ID = 2784
Memory Pool Type = Application Heap
Current size (bytes) = 1900544
High water mark (bytes) = 1900544
Maximum size allowed (bytes) = 2326528

Database partition number = 0
Agent process/thread ID = 2332
Memory Pool Type = Application Heap
Current size (bytes) = 1900544
High water mark (bytes) = 1966080
Maximum size allowed (bytes) = 2326528

Database partition number = 0
Agent process/thread ID = 2712
Memory Pool Type = Application Heap
Current size (bytes) = 1900544
High water mark (bytes) = 1966080
Maximum size allowed (bytes) = 2326528
db2 =>
db2 => GET SNAPSHOT FOR TABLES ON DBNAME

Table Snapshot

First database connect timestamp = Not Collected

Last reset timestamp = Not Collected
Snapshot timestamp = 03-03-2004 15:22:00.473889
Database name = DBNAME
Database path = D:\DB2\NODE0000\SQL00003\
Input database alias = DBNAME
Number of accessed tables = 28

Table List
Table Schema = SYSIBM
Table Name = SYSSECTION
Table Type = Catalog
Rows Read = 10
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_01
Table Type = User
Rows Read = 244590
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_15
Table Type = User
Rows Read = 22380
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_06
Table Type = User
Rows Read = 94920
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_09
Table Type = User
Rows Read = 103560
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = SYSIBM
Table Name = SYSTABLESPACES
Table Type = Catalog
Rows Read = 152
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = SYSIBM
Table Name = SYSTABLES
Table Type = Catalog
Rows Read = 152
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_17
Table Type = User
Rows Read = 370080
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_04
Table Type = User
Rows Read = 88710
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_18
Table Type = User
Rows Read = 496200
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_05
Table Type = User
Rows Read = 359460
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_22
Table Type = User
Rows Read = 412380
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_10
Table Type = User
Rows Read = 128580
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_21
Table Type = User
Rows Read = 175320
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_11
Table Type = User
Rows Read = 313680
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_07
Table Type = User
Rows Read = 767220
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_08
Table Type = User
Rows Read = 905100
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_20
Table Type = User
Rows Read = 149760
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_19
Table Type = User
Rows Read = 505140
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_14
Table Type = User
Rows Read = 219900
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_13
Table Type = User
Rows Read = 294120
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_12
Table Type = User
Rows Read = 337260
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = CHRM_02
Table Type = User
Rows Read = 291690
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = DBNAME_MARKERS
Table Type = User
Rows Read = 211822
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = DBNAME_MARKER_DES
Table Type = User
Rows Read = 211822
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = SIG_RULE_CONDTNS
Table Type = User
Rows Read = 543084
Rows Written = 0
Overflows = 0
Page Reorgs = 0

Table Schema = DB2ADMIN
Table Name = SIG_ASSC_RULE_SUBJECT
Table Type = User
Rows Read = 93873
Rows Written = 231458
Overflows = 0
Page Reorgs = 421

Table Schema = DB2ADMIN
Table Name = SIG_TMP_SUBJECT_ID
Table Type = User
Rows Read = 4646198
Rows Written = 3113710
Overflows = 0
Page Reorgs = 15556
db2 =>
db2 => GET SNAPSHOT FOR TABLESPACES ON DBNAME

Tablespace Snapshot

First database connect timestamp = Not Collected
Last reset timestamp = Not Collected
Snapshot timestamp = 03-03-2004
15:23:11.370381
Database name = DBNAME
Database path = D:\DB2\NODE0000\SQL00003\
Input database alias = DBNAME
Number of accessed tablespaces = 5
Tablespace name = SYSCATSPACE
Tablespace ID = 0
Tablespace Type = System managed space
Tablespace Content Type = Any data
Tablespace Page size (bytes) = 4096
Tablespace Extent size (pages) = 32
Tablespace Prefetch size (pages) = 32
Buffer pool ID currently in use = 1
Buffer pool ID next startup = 1
Tablespace State = 0x'00000000'
Detailed explanation:
Normal
Total number of pages = 18049
Number of usable pages = 18049
Number of used pages = 18049
Minimum Recovery Time =
Number of quiescers = 0
Number of containers = 1

Container Name =
D:\DB2\CONTAINERS\DBNAME\CATALOGS
Container ID = 0
Container Type = Path
Total Pages in Container = 18049
Usable Pages in Container = 18049
Stripe Set = 0
Container is accessible = Yes

Buffer pool data logical reads = 314
Buffer pool data physical reads = 0
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Asynchronous pool data page reads = 0
Buffer pool data writes = 0
Asynchronous pool data page writes = 0
Buffer pool index logical reads = 488
Buffer pool index physical reads = 0
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
Asynchronous pool index page reads = 0
Buffer pool index writes = 0
Asynchronous pool index page writes = 0
Total buffer pool read time (ms) = 0
Total buffer pool write time (ms) = 0
Total elapsed asynchronous read time = 0
Total elapsed asynchronous write time = 0
Asynchronous data read requests = 0
Asynchronous index read requests = 0
No victim buffers available = 0
Direct reads = 352
Direct writes = 0
Direct read requests = 86
Direct write requests = 0
Direct reads elapsed time (ms) = 0
Direct write elapsed time (ms) = 0
Number of files closed = 0
Data pages copied to extended storage = 0
Index pages copied to extended storage = 0
Data pages copied from extended storage = 0
Index pages copied from extended storage = 0
Tablespace name = TEMPSPACE1
Tablespace ID = 1
Tablespace Type = System managed space
Tablespace Content Type = System Temporary data
Tablespace Page size (bytes) = 4096
Tablespace Extent size (pages) = 32
Tablespace Prefetch size (pages) = 32
Buffer pool ID currently in use = 1
Buffer pool ID next startup = 1
Tablespace State = 0x'00000000'
Detailed explanation:
Normal
Total number of pages = 1
Number of usable pages = 1
Number of used pages = 1
Minimum Recovery Time =
Number of quiescers = 0
Number of containers = 1

Container Name =
D:\DB2\CONTAINERS\DBNAME\USER\TEMP
ORARY
Container ID = 0
Container Type = Path
Total Pages in Container = 1
Usable Pages in Container = 1
Stripe Set = 0
Container is accessible = Yes

Buffer pool data logical reads = 0
Buffer pool data physical reads = 0
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Asynchronous pool data page reads = 0
Buffer pool data writes = 0
Asynchronous pool data page writes = 0
Buffer pool index logical reads = 0
Buffer pool index physical reads = 0
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
Asynchronous pool index page reads = 0
Buffer pool index writes = 0
Asynchronous pool index page writes = 0
Total buffer pool read time (ms) = 0
Total buffer pool write time (ms) = 0
Total elapsed asynchronous read time = 0
Total elapsed asynchronous write time = 0
Asynchronous data read requests = 0
Asynchronous index read requests = 0
No victim buffers available = 0
Direct reads = 0
Direct writes = 0
Direct read requests = 0
Direct write requests = 0
Direct reads elapsed time (ms) = 0
Direct write elapsed time (ms) = 0
Number of files closed = 0
Data pages copied to extended storage = 0
Index pages copied to extended storage = 0
Data pages copied from extended storage = 0
Index pages copied from extended storage = 0
Tablespace name = USERSPACE1
Tablespace ID = 2
Tablespace Type = System managed space
Tablespace Content Type = Any data
Tablespace Page size (bytes) = 4096
Tablespace Extent size (pages) = 64
Tablespace Prefetch size (pages) = 64
Buffer pool ID currently in use = 1
Buffer pool ID next startup = 1
Tablespace State = 0x'00000000'
Detailed explanation:
Normal
Total number of pages = 1
Number of usable pages = 1
Number of used pages = 1
Minimum Recovery Time =
Number of quiescers = 0
Number of containers = 1

Container Name =
D:\DB2\CONTAINERS\DBNAME\USER\TABL
ESPACES
Container ID = 0
Container Type = Path
Total Pages in Container = 1
Usable Pages in Container = 1
Stripe Set = 0
Container is accessible = Yes

Buffer pool data logical reads = 0
Buffer pool data physical reads = 0
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Asynchronous pool data page reads = 0
Buffer pool data writes = 0
Asynchronous pool data page writes = 0
Buffer pool index logical reads = 0
Buffer pool index physical reads = 0
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
Asynchronous pool index page reads = 0
Buffer pool index writes = 0
Asynchronous pool index page writes = 0
Total buffer pool read time (ms) = 0
Total buffer pool write time (ms) = 0
Total elapsed asynchronous read time = 0
Total elapsed asynchronous write time = 0
Asynchronous data read requests = 0
Asynchronous index read requests = 0
No victim buffers available = 0
Direct reads = 0
Direct writes = 0
Direct read requests = 0
Direct write requests = 0
Direct reads elapsed time (ms) = 0
Direct write elapsed time (ms) = 0
Number of files closed = 0
Data pages copied to extended storage = 0
Index pages copied to extended storage = 0
Data pages copied from extended storage = 0
Index pages copied from extended storage = 0
Tablespace name = RESULTS
Tablespace ID = 3
Tablespace Type = System managed space
Tablespace Content Type = Any data
Tablespace Page size (bytes) = 4096
Tablespace Extent size (pages) = 64
Tablespace Prefetch size (pages) = 128
Buffer pool ID currently in use = 3
Buffer pool ID next startup = 3
Tablespace State = 0x'00000000'
Detailed explanation:
Normal
Total number of pages = 5027
Number of usable pages = 5027
Number of used pages = 5027
Minimum Recovery Time =
Number of quiescers = 0
Number of containers = 1

Container Name =
D:\DB2\CONTAINERS\DBNAME\TABLESPAC
ES\RESULTS
Container ID = 0
Container Type = Path
Total Pages in Container = 5027
Usable Pages in Container = 5027
Stripe Set = 0
Container is accessible = Yes

Buffer pool data logical reads = 2184904
Buffer pool data physical reads = 0
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Asynchronous pool data page reads = 0
Buffer pool data writes = 1422
Asynchronous pool data page writes = 0
Buffer pool index logical reads = 4980536
Buffer pool index physical reads = 379
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
Asynchronous pool index page reads = 0
Buffer pool index writes = 1533
Asynchronous pool index page writes = 0
Total buffer pool read time (ms) = 0
Total buffer pool write time (ms) = 0
Total elapsed asynchronous read time = 0
Total elapsed asynchronous write time = 0
Asynchronous data read requests = 0
Asynchronous index read requests = 0
No victim buffers available = 0
Direct reads = 0
Direct writes = 3584
Direct read requests = 0
Direct write requests = 14
Direct reads elapsed time (ms) = 0
Direct write elapsed time (ms) = 24002381
Number of files closed = 0
Data pages copied to extended storage = 0
Index pages copied to extended storage = 0
Data pages copied from extended storage = 0
Index pages copied from extended storage = 0
Tablespace name = RAWDATA
Tablespace ID = 4
Tablespace Type = System managed space
Tablespace Content Type = Any data
Tablespace Page size (bytes) = 4096
Tablespace Extent size (pages) = 64
Tablespace Prefetch size (pages) = 128
Buffer pool ID currently in use = 2
Buffer pool ID next startup = 2
Tablespace State = 0x'00000000'
Detailed explanation:
Normal
Total number of pages = 1522
Number of usable pages = 1522
Number of used pages = 1522
Minimum Recovery Time =
Number of quiescers = 0
Number of containers = 1

Container Name =
D:\DB2\CONTAINERS\DBNAME\TABLESPAC
ES\RAWDATA
Container ID = 0
Container Type = Path
Total Pages in Container = 1522
Usable Pages in Container = 1522
Stripe Set = 0
Container is accessible = Yes

Buffer pool data logical reads = 6565153
Buffer pool data physical reads = 1
Buffer pool temporary data logical reads = 0
Buffer pool temporary data physical reads = 0
Asynchronous pool data page reads = 0
Buffer pool data writes = 0
Asynchronous pool data page writes = 0
Buffer pool index logical reads = 1911061
Buffer pool index physical reads = 0
Buffer pool temporary index logical reads = 0
Buffer pool temporary index physical reads = 0
Asynchronous pool index page reads = 0
Buffer pool index writes = 0
Asynchronous pool index page writes = 0
Total buffer pool read time (ms) = 0
Total buffer pool write time (ms) = 0
Total elapsed asynchronous read time = 0
Total elapsed asynchronous write time = 0
Asynchronous data read requests = 0
Asynchronous index read requests = 0
No victim buffers available = 0
Direct reads = 0
Direct writes = 0
Direct read requests = 0
Direct write requests = 0
Direct reads elapsed time (ms) = 0
Direct write elapsed time (ms) = 0
Number of files closed = 0
Data pages copied to extended storage = 0
Index pages copied to extended storage = 0
Data pages copied from extended storage = 0
Index pages copied from extended storage = 0

db2 =>
Nov 12 '05 #1
2 2370

"Tim.D" <td******@hotmail.com> wrote in message
news:11**************************@posting.google.c om...
Hello people,

Thanks to Serge, PM, Knut and a host of others I have now successfully
completed my very first SQL Stored Procedure. Takes some 13mins or so
to run, but that was expected as it does a fairly significant number
of small single select and inserts from various cursors. I am very
pleased with the results and can find no errors after a few days
debugging a couple of never ending loops.

Interestingly though, while processing it registers virtually nil CPU
usage, somthing in the order of 5-7% at best which confuses me to be
honest. In truth the selects are all very basic, no joins, on small
tables. One cursor has to store 28000 records and a 'while' statement
then loops through those opening 3 other nested 'while' cursors.

I had a problem with the log thrashing but turned that off at the
table via not logging which solved that. Disk activity is fine as I
stood in fornt of the server while it was running and the disks are
only active say every 4 secs or so and only very very slightly at
that. Windows monitor shows nothing excessive, I ran all the monitor
switches and viewed virtually all of the avaible keys via that and can
find nothing that would indicate a problem at all. Indeed there
doesnt appear to be one .. heh

I was just wondering why such a small cpu utilization is all.

Ive pasted the results of the various snapshots .. sorry for the size.

Could some kind soul take a look and see if anything glaring stands
out.
<snipped snapshots>

I see a couple of things which might be causing you problems:

1) Lots of sorts. You mention that you are doing lots of operations on
small tables. The high number of sorts makes me wonder if you're
continually sorting a small number of rows repeatedly in one of your nested
cursors. You don't seem to be spilling to disk (which is good), but doing
the same sort operations over and over will be very expensive. You might
want to consider creating indexes on some of your smaller tables so that
they can use the index to read the rows in pre-sorted order.
Total sorts = 497348
Total sort time (ms) = 178365
2) Lots of queries returning very few rows. SELECT queries, on average, are
returning 1.6 rows. DELETE/INSERT queries, on average, affect 1.9 rows. If
you can redesign your SQL to operate on more rows per statement (ie, doing
operations on sets of rows instead of iterating through each and every row)
you will improve your execution performance greatly.
Select SQL statements executed = 5331310
Update/Insert/Delete statements executed = 2317654 Rows deleted = 2178099
Rows inserted = 2267288
Rows updated = 0
Rows selected = 8530280
Rows read = 16117740


--
Matt Emmerton
DB2 OLTP Performance
IBM Toronto Lab
Nov 12 '05 #2
> <snipped snapshots>

I see a couple of things which might be causing you problems:

1) Lots of sorts. You mention that you are doing lots of operations on
small tables. The high number of sorts makes me wonder if you're
continually sorting a small number of rows repeatedly in one of your nested
cursors. You don't seem to be spilling to disk (which is good), but doing
the same sort operations over and over will be very expensive. You might
want to consider creating indexes on some of your smaller tables so that
they can use the index to read the rows in pre-sorted order.
Total sorts = 497348
Total sort time (ms) = 178365


2) Lots of queries returning very few rows. SELECT queries, on average, are
returning 1.6 rows. DELETE/INSERT queries, on average, affect 1.9 rows. If
you can redesign your SQL to operate on more rows per statement (ie, doing
operations on sets of rows instead of iterating through each and every row)
you will improve your execution performance greatly.
Select SQL statements executed = 5331310
Update/Insert/Delete statements executed = 2317654

Rows deleted = 2178099
Rows inserted = 2267288
Rows updated = 0
Rows selected = 8530280
Rows read = 16117740


Hi Matt, thanks for taking the time to have a look. Indeed this
confirms what I was thinking which is good and bad in a way. Good that
nothing else is apparent and bad in that unfortunately this is the way
I designed it .. heh

We are dealing with a rule set of some 28k, each rule is made up of
elements that are parsed and ppreviously inserted into an elements
table containing the rule id and element. Therefore multiple elements
per id [avg 4 or so], We then have to deal with each one seperately.
Translate the element to text, find its corresponding marker shall we
say, look up the marker id and write a tmp record for each marker. We
then move on to the next element and so on. Once all elements are
returned for a rule, we have to match all of the marker ids to the
number of elements for the rule and return only those that match,
insert those into sub_id table, delete the tmp and go to the next
rule. 28000 times .. heh

Long way around I guess but the only way I could think to do it. Thus
the low number of rows returned on avg. I only hvae one 'larger'
cursor that stores all of the 28k rule ids, then does a 'while' loop
through each one with progressively less complex sql as you get into
the nested cursors.

I figured why the cpu was so low, hyperthreading was enabled on the
w2k server wich severely hampers performance. Turning that off, the
entire operation took some 6 mins, half of the hyperthreaded time and
an avg 35% cpu util.

Any ideas on the official word from IBM on hyperthreading ? I guess
seeing as Microsoft state that windows 2000 does ot officially take
advantage of hyperthreading its perhaps a mute point.

Thanks again,

Tim
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: June Moore | last post by:
Hi all, I have a stored procedure that return a resultset e.g. stored proc: get_employee_details select emp_id, emp_name, emp_salary, emp_position from empoloyee I would like to write...
9
by: Wolfgang Kreuzer | last post by:
Try hard to become familiar with T-SQL. Can anybodey tell me the best way to deal with set's provided by a stored procedure. Til yesterday I thougt trapping set in temp table using INSERT EXEC...
0
by: Dave Sisk | last post by:
I've created a system or external trigger on an AS/400 file a.k.a DB2 table. (Note this is an external trigger defined with the ADDPFTRG CL command, not a SQL trigger defined with the CREATE...
5
by: Rhino | last post by:
This question relates to DB2 Version 6 on OS/390. Can a (COBOL) stored procedure on this platform do file I/O, i.e. write to a sequential file? I am trying to debug a stored procedure. As far...
2
by: Rhino | last post by:
I am getting an sqlcode of -927 when I execute SQL within a COBOL stored procedure in DB2 OS/390 Version 6 on OS/390. I have looked at the error message for that condition and tried everything I...
1
by: mike | last post by:
If I try and do a "SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1" after I have run a stored procedure in DB2 version 7.2, I get the last generated Key before the CallableStatement was executed...
14
by: Roy | last post by:
Apologies for the cross-post, but this truly is a two-sided question. Given the option of creating Looping statements within a stored proc of sql server or in the code-behind of an .net webpage,...
0
by: balaji krishna | last post by:
Hi, I need to handle the return set from COBOL stored procedure from my invoking Java program. I do not know, how many rows the stored proc SQL fetches.I have declared the cursor in that proc, but i...
0
by: mirandacascade | last post by:
Questions toward the bottom of the post. Situation is this: 1) Access 97 2) SQL Server 2000 3) The Access app: a) sets up pass-thru query b) .SQL property of querydef is a string, the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.